Commit graph

2462 commits

Author SHA1 Message Date
JohannesIBK
905df7ef3a
add array support for NonZeroI* in postgres (#3303)
* add array support for NonZeroI* in postgres

* run rustfmt
2024-07-16 13:46:43 -07:00
Frank Elsinga
3396ed015b
chore: fixed one usage of select_input_type!() being unhygenic (#3327)
The `$crate::` is currently not nessesary, but future refactorings might get tripped up if the typo is not fixed
2024-07-16 13:46:18 -07:00
YgorSouza
f2f17a7bc5
fix(postgres): don't panic if M or C Notice fields are not UTF-8 (#3346)
* fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8

This has been observed with an old version of PostgreSQL (11.0.4)
running on Windows Server 2016 with windows-1252 encoding and French
locale.

This change replaces invalid UTF-8 fields with a default string, so the
other fields can still be read if they are valid.

* Revert "fix(postgres): don't panic if `M` or `C` Notice fields are not UTF-8"

This reverts commit 362ca98bbd.

* Check that Notice M and C fields are valid UTF-8

Otherwise, we return the invalid UTF-8 error to avoid panicking later.
2024-07-16 00:27:20 -07:00
Hamir Mahal
83a7d14e58
fix: comment not separated from other characters (#3328) 2024-07-15 20:00:41 -07:00
Eric Torreborre
b71221cd74
use the persistent query setting with the Any driver (#3297) 2024-07-15 16:57:43 -07:00
James H
0db12a9846
feat(cube): support postgres cube (#3188)
* feat: add cube

* docs: cube docs

* docs: update readme

* fix: cube is now not feature flagged

* fix: formatting

* fix: typeo for PgCube vs Cube

* fix: correct types

* fix: postgres only types for cube

* fix: cube readme

* fix: dont unwrap cubes

* fix: typo on interval

* fix: zero volume cube array

* fix: return type

* fix: update tests

* fix: run with one test type

* fix: log bytes in error

* fix: typo in test

* fix: log bytes for failed length

* fix: string deser

* docs: remove cube from readme

* fix: int to float

* fix: trim floats

* fix: exttra test

* fix: type safe into vectors

* fix: improve error messages

* docs: remove comments

* fix: front load most important logic and const at start

* fix: extract constants

* fix: flags

* fix: avoid redundant buffer creation and use FromStr trait

* fix: handle serializing

* test: cube vec test

* fix: no array cube test

* fix: update test with array for cube

* fix: dont use try from for u8

* fix: conditionally remove padding

* fix: conditional trimming

* fix: idiomatic trimming

* fix: linting

* fix: remove whitespace

* fix: lower case array

* fix: spacing input

* test: one more vec test

* fix: trim square brackets in case they are using postgres spec page

* fix: result types

* fix: format

* fix: box error

* fix: the borrow produces a value

* fix: self serialise

* chore: merge main

* fix: borrow

* fix: clippy

---------

Co-authored-by: James Holman <james.holman@betashares.com.au>
2024-07-11 22:30:49 -07:00
etorreborre
93f3d79f83 track the kind of null arguments in order to provide the appropriate type when converting them 2024-07-11 15:06:55 -07:00
Nick Kocharhook
1e1697f655 Change to cfg!(not()) (#3275) 2024-07-11 15:03:18 -07:00
Nick Kocharhook
e565123ca3 Invert boolean for migrate error message. (#3275) 2024-07-11 15:03:18 -07:00
Joshua Potts
d1f180fbc5 fix: Minimally upgrade minimal dependencies to resolve build issues on declared minimum versions
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-11 11:59:15 -07:00
Joshua Potts
0546e0cfa9 ci: Add job to check that sqlx builds with its declared minimum dependencies
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-11 11:59:15 -07:00
Joshua Potts
ba1b2f9b82 refactor: Resolve cargo check warnings in postgres examples
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-07-10 22:15:31 -07:00
DirectorX
22e52c1171 allow rename with rename_all (close #2896) 2024-07-10 22:15:09 -07:00
Austin Bonander
16e3f1025a fix(postgres): add missing type resolution for arrays by name 2024-07-08 00:14:19 -07:00
Austin Bonander
efbf57265c fix: use correct syntax in tests/postgres/setup.sql 2024-07-08 00:14:19 -07:00
etorreborre
0eb2ee9365 feat: support the postgres bool type 2024-06-20 18:26:52 -07:00
alu
33aee07094 Remove compatibility check by collations. 2024-06-20 11:57:05 -07:00
alu
ce6d75208b Changed to collation which is the actual name. 2024-06-20 11:57:05 -07:00
Cristian Le
92de9d42a6 Add LICENSE-* files to crates 2024-06-20 10:56:08 -07:00
Lílian Ferreira de Freitas
402022df87 fix: use correct names for sslmode options
The names for the SSL mode options were incorrect, added test for making
sure the built url can be parsed to ensure internal consistency at
least. Also changed "ssl-mode" to "sslmode" as it seems more standard
and sqlx can parse both.
2024-06-15 11:59:31 -07:00
Austin Bonander
2618439663 fix(postgres): case-aware type name equality 2024-06-15 11:57:33 -07:00
Austin Bonander
32143363bc fix trailing line break 2024-06-15 11:57:33 -07:00
Austin Bonander
088a374ebb fix compilation errors 2024-06-15 11:57:33 -07:00
Austin Bonander
352310ba34 fix: run rustfmt 2024-06-15 11:57:33 -07:00
Austin Bonander
80359d1ada fix(postgres): derive PgHasArrayType for enums 2024-06-15 11:57:33 -07:00
Austin Bonander
10192019d8 fix(postgres): get correctly qualified type name in describe 2024-06-15 11:57:33 -07:00
Austin Bonander
05a10de4d8 fix: suppress dead_code warnings 2024-06-13 13:11:36 -07:00
Austin Bonander
3418455482 fix: ignore flaky copy_can_work_with_failed_transactions test 2024-06-13 13:11:36 -07:00
Austin Bonander
948264ff93 fix: ignore flaky test_connection_maintenance test 2024-06-13 13:11:36 -07:00
Austin Bonander
f7301f67d1 fix(ci): don't run TLS tests when building without TLS (duh) 2024-06-13 13:11:36 -07:00
Austin Bonander
16ffaed73b fix(ci): stop testing on MySQL 5.7
MySQL 5.7 was EOL'd in October 2023.
2024-06-13 13:11:36 -07:00
Austin Bonander
79a5830437 fix: missing DATABASE_URL in CI
the changed steps weren't actually meant to run the tests yet
2024-06-13 13:11:36 -07:00
Austin Bonander
bae083cf79 fix: clippy warnings 2024-06-13 13:11:36 -07:00
Austin Bonander
41089f3655 fix: add mariadb:11.4 to tests/docker-compose.yml 2024-06-13 13:11:36 -07:00
Austin Bonander
0f6054cf81 fix: run cargo fmt 2024-06-13 13:11:36 -07:00
Joel Koen
1388fc8acc
docs(sqlite): fix typo - unixtime() -> unixepoch() (#3271) 2024-06-07 02:51:52 -06:00
gridbox
0ea90881c1
feat: Add set_update_hook on SqliteConnection (#3260)
* feat: Add set_update_hook on SqliteConnection

* refactor: Address PR comments

* fix: Expose UpdateHookResult for public use

---------

Co-authored-by: John Smith <asserta4@gmail.com>
2024-06-05 19:06:15 -07:00
Daniel Black
8b7f352be8
ci: syntax fix (#3267)
Correct:

Invalid workflow file: .github/workflows/sqlx.yml#L207
You have an error in your yaml syntax on line 207
2024-06-05 19:04:51 -07:00
Dario Heinisch
c57bcb967f
Hide docs for any (#3254) 2024-06-05 18:21:10 -07:00
Stepan Tubanov
5da0f73746
perf: box MySqlConnection to reduce sizes of futures (#3265) 2024-06-05 18:19:30 -07:00
Daniel Black
4d9f67b7b4
ci: MariaDB - add back 11.4 and add 11.5 (#3266)
* Revert "fix(ci): disable `mariadb_verylatest` pass for RusTLS"

This reverts commit c78425b3ac.

MariaDB 11.4.2 now includes the upstream fix for this.

Closes: 3091

* ci: mariadb 11.4 now GA/Stable
2024-06-05 18:18:58 -07:00
AlphaKeks
6561830421
feat: support NonZero* scalar types (#3244)
* feat: support `NonZero*` scalar types

This commits adds `Type`, `Encode`, and `Decode` impls for all the
`NonZero*` types from the standard library. They are implemented as
direct proxies to their primitive counterparts, except that when
decoding, the values are checked to not be zero.

* fixup!: remove `non-zero` cargo feature

* fixup!: make `non-zero` module private

* fixup!: rebase and fix trait impls
2024-06-05 13:18:04 -06:00
ben
1ce0e760de
fix: Decode and Encode derives (#2940) 2024-05-31 13:04:13 -07:00
Ralph Bisschops
240b4fffd3
Fix several inter doc links (#2954) 2024-05-31 12:59:08 -07:00
tyrelr
f960d5bc3b
Sqlite explain graph (#3064)
* convert logger to output a query graph

* avoid duplicating branch paths to shrink output graph

* separate different branching paths

* include all branches which found unique states

* track the reason for ending each branches execution

* track the result type of each branch

* make edges rely on history index instead of program_id, to avoid errors when looping

* add state diff to query graph

* drop redundant table info

* rework graph to show state changes, rework logger to store state snapshots

* show state on the previous operation

* gather duplicate state changes into clusters to reduce repetition

* draw invisible connections between unknown instructions by program_i

* clean up dot format string escaping

* add test case from #1960 (update returning all columns)

* add tests for #2939 (update returning only the PK column)

* allow inserting into a table using only the index

* improve null handling of IfNull, fix output type of NewRowId

* add NoResult nodes for branches which don't log a result, as a sanity check

* add short-circuit to all logging operations

* remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output

* add failing test for awkwardly nested/filtered count subquery

* handle special case of return operation to fix failing test

* require trace log level instead of using whatever log level  statement logging was configured to use
2024-05-31 12:57:54 -07:00
Liam Gray
2df770a10b
SqliteConnectOptions::filename() memory fix (#3136) (#3137)
* SqliteConnectOptions::filename() memory fix (#3136)

* Expose in_memory sqlite option

* Docs SqliteConnectOptions::filename include mention of from_str alternative

* Docs SqliteConnectOptions::filename typo fix
2024-05-31 12:45:27 -07:00
Max Bruckner
c57b46ceb6
Make Encode return a result (#3126)
* Make encode and encode_by_ref fallible

This only changes the trait for now and makes it compile, calling .expect() on all users. Those will be removed in a later commit.

* PgNumeric: Turn TryFrom Decimal to an infallible From

* Turn panics in Encode implementations into errors

* Add Encode error analogous to the Decode error

* Propagate decode errors through Arguments::add

This pushes the panics one level further to mostly bind calls. Those will also be removed later.

* Only check argument encoding at the end

* Use Result in Query internally

* Implement query_with functions in terms of _with_result

* Surface encode errors when executing a query.

* Remove remaining panics in AnyConnectionBackend implementations

* PostgreSQL BigDecimal: Return encode error immediately

* Arguments: Add len method to report how many arguments were added

* Query::bind: Report which argument failed to encode

* IsNull: Add is_null method

* MySqlArguments: Replace manual bitmap code with NullBitMap helper type

* Roll back buffer in MySqlArguments if encoding fails

* Roll back buffer in SqliteArguments if encoding fails

* Roll back PgArgumentBuffer if encoding fails
2024-05-31 12:42:36 -07:00
Lílian
6c1e3a4e61
fix: resolve path ownership problems when using sqlx_macros_unstable (#3236)
* fix: make resolve_blocking not take ownership of path

When using sqlx_macros_unstable the codepath taken further uses the path
variable and it is more convenient to not take ownership but instead
pass references to needed functions.

* fix: change &PathBuf to &Path in resolve_blocking
2024-05-30 15:46:14 -07:00
Jason Ish
0449ac5c1f
fix: sqlite pragma order for auto_vacuum (#3230)
* fix: sqlite pragma order for auto_vacuum

Setting the auto_vacuum pragma must come before setting the journal
mode otherwise it won't apply.

* fix: better documentation for auto_vacuum

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-05-17 18:58:02 -07:00
Jason Ish
e7f71900f8
fix: get_filename should not consume self (#3233) 2024-05-17 18:57:49 -07:00