1225 Commits

Author SHA1 Message Date
Austin Bonander
f35ebbdb41 fix warnings 2026-02-27 18:34:02 -08:00
Austin Bonander
b09d9568d2 refactor: delete pool parenting 2026-02-27 18:18:27 -08:00
Austin Bonander
f40a3fd4d8 chore: fix warnings 2026-02-27 16:13:08 -08:00
Austin Bonander
d6d4e59272 fix: run cargo fmt 2026-02-27 14:05:28 -08:00
Austin Bonander
4485e09798 WIP refactor: replace sharding with single connection set (6) 2026-02-27 14:05:28 -08:00
Austin Bonander
77d076f70d WIP refactor: replace sharding with single connection set (5) 2026-02-27 14:05:28 -08:00
Austin Bonander
831a5de71b feat: add tracing-flame to benches/any-pool 2026-02-27 14:05:28 -08:00
Austin Bonander
ac40323e4c WIP refactor: simpler acquire strategy 2026-02-27 14:05:28 -08:00
Austin Bonander
e89775258a WIP refactor: replace sharding with single connection set 2026-02-27 14:05:28 -08:00
Austin Bonander
fee55df248 fix: debug timeouts in benchmark 2026-02-27 14:05:28 -08:00
Austin Bonander
3f30e698c8 fix: bugs in sharded pool 2026-02-27 14:05:28 -08:00
Austin Bonander
f9c5b949ec chore: Cargo.lock after rebase 2026-02-27 14:05:28 -08:00
Austin Bonander
32012f8855 WIP feat: integrate sharding into pool 2026-02-27 14:05:28 -08:00
Austin Bonander
a02546d23e feat: create sharding structure for pool 2026-02-27 14:05:28 -08:00
Austin Bonander
568471d90a fix: errors after rebasing 2026-02-27 14:05:28 -08:00
Austin Bonander
965ae1b398 fix(pool): tweaks and fixes 2026-02-27 14:05:28 -08:00
Austin Bonander
69c071b245 fix(pool): use .fuse() 2026-02-27 14:05:28 -08:00
Austin Bonander
d0f598fc0b fix(pool): use the correct method in try_min_connections 2026-02-27 14:05:28 -08:00
Austin Bonander
6c1564a9d5 fix(pool): don't stop emptying idle queue in .close() 2026-02-27 14:05:28 -08:00
Austin Bonander
7a31c90ae0 fix: tests 2026-02-27 14:05:28 -08:00
Austin Bonander
4eae60853f chore: delete defunct use of futures-intrusive 2026-02-27 14:05:28 -08:00
Austin Bonander
c02e5eee37 fix: compilation error, warnings 2026-02-27 14:05:28 -08:00
Austin Bonander
e3cf5db6fe feat(pool): add more info to impl Debug for PoolConnection 2026-02-27 14:05:28 -08:00
Austin Bonander
b74cf8a185 fix(pool): add timeout to return_to_pool() 2026-02-27 14:05:28 -08:00
Austin Bonander
e1a3a623c5 refactor(pool): use a unique ID per connection 2026-02-27 14:05:28 -08:00
Austin Bonander
f02354dccd fix(pool): spawn task for before_acquire 2026-02-27 14:05:28 -08:00
Austin Bonander
8efb358593 WIP pool changes 2026-02-27 14:05:28 -08:00
Austin Bonander
418bcbb80e breaking(pool): use usize for all connection counts 2026-02-27 14:05:28 -08:00
Cathal
7248f64244
breaking: make offline optional to allow building without serde (#4077)
* refactor(postgres): split describe into resolve and explain

* refactor(postgres): remove duplicated code from resolve and explain

* breaking: make `offline` optional to allow building without `serde`
2026-02-05 17:06:30 -08:00
tottoto
9645a9ad8d
Update to webpki-roots 1 (#4042) 2026-02-05 16:58:33 -08:00
Joey de Waal
8189f897ce
Add on unimplemented diagnostic to SqlStr (#4153)
* add diagnostic to `SqlStr`

* Update note
2026-02-02 07:13:52 -08:00
chrxn1c
93bafbefd6
feat: add self-extractor for JSON type (#4123) 2026-01-17 12:40:53 -08:00
Joey de Waal
e8384f2a00
fix spelling (#4069) 2025-10-28 05:18:47 -07:00
Andreas Molitor
e4afbd4ca1
chore: update hashlink to v0.11.0 (#4072)
Co-authored-by: amolitor <andreas.molitor@andrena.de>
2025-10-28 04:46:25 -07:00
Kevin R
a802da0e67
Fix typo in migration example from 'uesrs' to 'users' (#4068) 2025-10-22 19:40:50 +02:00
Austin Bonander
946b6d4d16 fix: break dev-dependency cycle because of rust-lang/cargo#15622 2025-10-14 19:08:15 -07:00
Austin Bonander
388c424f48
fix(macros): smarter .env loading, caching, and invalidation (#4053)
* fix(macros): smarter `.env` loading, caching, and invalidation

* feat(mysql): test `.env` loading in CI

* feat(postgres): test `.env` loading in CI

* feat(macros): allow `DATABASE_URL` to be empty

* fix(examples/postgres): make `cargo-sqlx` executable

* fix(examples/postgres): `cargo sqlx` invocation

* feat(examples/postgres): check offline prepare on more examples

* fix(examples/postgres): the name of this step

* fix(cli): don't suppress error from `dotenv()`

* fix(ci/examples/postgres): don't use heredoc in this step

* fix(ci/examples/postgres): multi-tenant

* fix(ci/examples/sqlite): test `.env` loading

* chore: add CHANGELOG entry
2025-10-14 17:31:12 -07:00
David Uebler
064d649abd
native tls handshake: build TlsConnector in blocking threadpool (#4027)
* build TlsConnector in blocking threadpool

The openssl TlsConnector synchronously loads certificates from files.
Loading these files can block for tens of milliseconds.

* Update sqlx-core/src/net/tls/tls_native_tls.rs

---------

Co-authored-by: David Übler <david.uebler@puzzleyou.de>
Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2025-09-23 07:23:01 -07:00
iamjpotts
81526898d4
refactor(core): Remove lifetime parameter from Arguments trait (#3960)
* refactor(core): Remove lifetime parameter from Arguments trait

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(core): Also relax lifetime of argument passed to Query::bind and Query::try_bind

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

---------

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2025-09-13 21:47:45 -07:00
iamjpotts
54a0492ee2
refactor(any): Remove lifetime parameter from AnyArguments (#3958)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2025-09-12 16:11:39 -07:00
Austin Bonander
66526d9c56
refactor: tweaks after #3791 (#4022)
* restore fallback to `async-io` for `connect_tcp()` when `runtime-tokio` feature is enabled
* `smol` and `async-global-executor` both use `async-task`, so `JoinHandle` impls can be consolidated
* no need for duplicate `yield_now()` impls
* delete `impl Socket for ()`
2025-09-08 14:28:58 -07:00
Paul Xu
500cd18f19
Add Migrator::with_migrations() constructor (#4020)
* Add the helper function with_migrations() to Migrator.

* cargo fmt

* cargo fmt

* cargo fmt

* Improve comments.
2025-09-08 14:01:23 -07:00
martin-kolarik
6b828e698f
Smol+async global executor 1.80 dev (#3791)
* Sqlx-core: rename async_io dependency for async-std

* Sqlx-core: simplify TimeoutError

* Sqlx-core: code for async-global-executor

* Sqlx: integrate async-global-executor feature

* Note to unsafe

* Step up MSRV as async-global-executor needs it

* Sqlx-core: fix of unix socket build

* Unsafe fixes, smol executor added

* Workflow fix

* Changes outside sqlx_rt

* Cleanup conditional rt compilation

* Warning

* Add executors to test matrix

* Fix of skipping code sqlite due to mismatch in cargo feature names

* Smol executor isolated

* Fix, reduce number of tests, remove async_std

* Fix of test_block_on, regression

* Format fixes

* async-global-executor added

* async-std changed to 1.13

* litemap, zerofrom requires rustc 1.81

* Fix of missing _sqlite in cargo.toml

* Clippy lints

* Clean up

* Remove features combinations

* Fixes after merge

* Fix of compiling connect_tcp_address with both tokio + other executor selected

* Try to fix CI -Z minimal-versions check

Try to fix CI -Z minimal-versions check
2025-09-08 11:17:55 -07:00
Joey de Waal
4566df70a0
sqlx-postgres(tests): cleanup 2 unit tests. (#4002)
* sqlx-postgres(tests): fix positive_int domain type

* sqlx-postgres(tests): Update no pg array test

* sqlx-core: Remove conflicting Type impl for Box<JsonRawValue>
2025-08-26 22:29:10 -07:00
Dario Nieuwenhuis
648250dc6d
Add more JsonRawValue encode/decode impls. (#3859)
* Add support for `Box<JsonRawValue>` types.

This allows keeping structs that implement FromRow lifetime-free,
previously you had to use `&'a JsonRawValue`.

```rust
struct Foo {
    bar: Box<JsonRawValue>,
}
```

* Add Encode impls for `JsonRawValue`.
2025-08-25 16:40:26 -07:00
iamjpotts
0849fe3c5c
chore(core): Fix docstring for Query::try_bind (#3986)
* chore(core): Fix docstring for Query::try_bind

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* chore(core): Touch up docstring a little more

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

---------

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2025-08-21 22:11:12 -07:00
iamjpotts
ff93aa017a
refactor(sqlite): do not borrow bound values, delete lifetime on SqliteArguments (#3957)
* bug(sqlite): query macro argument lifetime use inconsistent with other db platforms

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Improve support for references as query macro bind arguments by removing lifetime parameter from SqliteArguments

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Introduce SqliteArgumentsBuffer type

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Improve cloning of SqliteArgumentValue, SqliteArguments, and SqliteArgumentsBuffer

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(any): Simplify AnyArguments::convert_to to convert_into

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

---------

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2025-08-19 13:59:37 -07:00
iamjpotts
e77f32ea5e
chore: Fix warnings for custom postgres_## cfg flags (#3950)
* chore: Fix warnings for custom postgres_## cfg flags

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* pr feedback - reorder cfg allowance; enable test_pg_copy_chunked test

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(postgres): Remove two more deprecated cfg flag uses (from docstrings)

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(ci): Use separate job for postgres ssl auth tests

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

---------

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2025-08-18 16:17:45 -07:00
Kevin Cox
ce878ce874
Correctly ROLLBACK transaction when dropped during BEGIN. (#3980)
Previously if the transaction was dropped while the transaction was being set up it was possible that the transaction was successfully opened but not closed. In common usage this would result in returning an open transaction to the connection pool which would have unexpected effects ranging from errors due to trying to nest transaction or serious bugs such as intended changes not occurring as they were unexpectedly inside a transaction that would never commit.

This resolves the issue by constructing the `Transaction` object (which activates the drop handler) before starting to open the transaction. In the worst case this could result in trying to `ROLLBACK` a transaction that was never started but this just results in a harmless error which is much better than leaving an unexpected open transaction active on the connection.

Fixes: https://github.com/launchbadge/sqlx/issues/3932
2025-08-18 16:16:17 -07:00
João Sampaio
5f8fc6b752
Pool.close: close all connections before returning (#3952)
* fix race condition in pool close (#3217)

* fix deadlock in the postgres/listen example

* Only acquire as many permits as a child pool can offer

---------

Co-authored-by: Adam Cigánek <adam.ciganek@proton.me>
2025-08-15 17:20:51 -07:00