Commit graph

2500 commits

Author SHA1 Message Date
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
Austin Bonander
60d033eda2
fix(ci): pin Rust version, ditch unmaintained actions (#3234) 2024-05-14 23:57:31 -07:00
Filip Gospodinov
5d6c33ed65
bump rustls to 0.21.11 (#3216)
This fixes security issue RUSTSEC-2024-0336 [1].

[1] https://rustsec.org/advisories/RUSTSEC-2024-0336
2024-04-26 16:26:52 -07:00
Dan Griffin
c82bf43e98
Fix leaking connections in fetch_optional (#2647) (#3194)
When using the 'Any' driver with MySQL backend, fetch_optional
does not return the connection to the pool if no results
are returned from the query. This is due to not all of the packets
being read from the underlying stream.

This fix continues to read result packets from the stream until they
have all been exhausted (just like the normal MySql drivers
implementation of fetch_optional). In general, a better refactoring would
be to call the MySQL fetch_optional code in the Any driver, rather than
re-implementing and duplicating code.
2024-04-24 19:18:55 -07:00
Grzegorz Bartoszek
a5d7fffc1b
Add Debug impl for PgRow (#2917) 2024-04-22 15:39:39 -07:00
Austin Bonander
439ac858d1
add #3211 to create-issue links 2024-04-20 18:30:46 -07:00
Pmarquez
ceac70f7fa
fix: Option decoding in any driver (#3172) 2024-04-19 15:46:03 -07:00
Feike Steenbergen
17d832b3de
PostgreSQL Bugfix: Ensure connection is usable after failed COPY inside a transaction (#3138)
* Include test case for regular subtransactions

While using COPY and subtransactions I kept running into errors.
This test case documents that error, it currently fails with:

    Error: encountered unexpected or invalid data: expecting ParseComplete but received CommandComplete

* PostgreSQL Copy: Consume ReadyForQuery on error

When a COPY statement was in error inside a subtransaction,
a Protocol Error used to be raised. By consuming the ReadyForQuery
message when there is an error, we no longer have this issue.
2024-04-19 15:45:05 -07:00
Raghav
e42ee35a76
fix(postgres) : int type conversion while decoding (#3173)
* fix(postgres) : int type conversion while decoding

* Check value buffer len when decoding integer type in postgres

* decode from octal for postgres i8

---------

Co-authored-by: RaghavRox <66472843+RaghavRox@users.noreply.github.com>
2024-04-19 15:43:06 -07:00
Jaime
40aef6da2c
feat: no tx migration (#3181)
* test: add a failing test

* feat: add no_tx to migration struct

* feat: execute migration with no tx block

* fix: expected string literal compilation error

* test: update no tx to content comment

* refactor: use the sql comment instead of file name semantics

* docs: remove no_tx from file format comment

* fix: remove filename matches

* fix: messed up merge

* refactor: dedupe migration

* fix: move comment to where it makes sense

* fix: linter error
2024-04-19 15:42:44 -07:00
Austin Bonander
25efb2f7f4
breaking(sqlite): always use i64 as intermediate when decoding (#3184)
Breaking changes:

* integer decoding will now loudly error on overflow instead of silently truncating.
* some usages of the query!() macros might change an i32 to an i64.

Also adds support for *decoding* `u64`s because there's no reason not to.

Closes #3179
2024-04-13 16:59:13 -07:00
BlackSoulHub
6a4f61e3b3
Update time to 0.3.36 (#3190)
* update time to 0.3.35

* fmt fix

* update version to 0.3.36
2024-04-11 19:26:12 -07:00
Lev Kokotov
03926dec15
Fix unclean TLS shutdown (#3191)
* Fix dirty shutdown

* generic comment
2024-04-10 17:10:27 -07:00