304 Commits

Author SHA1 Message Date
Austin Bonander
febc62aaab feat: create postgres/jiff-sqlx example 2025-04-11 21:27:12 -07:00
Austin Bonander
db6d28bfb1 feat: create postgres/multi-database example 2025-04-10 19:39:07 -07:00
Austin Bonander
4e95bafb35 Merge remote-tracking branch 'origin/main' into sqlx-toml
# Conflicts:
#	.github/workflows/examples.yml
#	sqlx-postgres/src/connection/mod.rs
2025-03-29 15:57:39 -07:00
Beau Gieskens
1c9cbe939a
feat: add ipnet support (#3710)
* feat: add ipnet support

* fix: ipnet not decoding IP address strings

* fix: prefer ipnetwork to ipnet for compatibility

* fix: unnecessary cfg
2025-03-23 17:19:05 -07:00
Austin Bonander
393b731d5e
Merge of #3427 (by @mpyw) and #3614 (by @bonsairobo) (#3765)
* feat: Implement `get_transaction_depth` for drivers

* test: Verify `get_transaction_depth()` on postgres

* Refactor: `TransactionManager` delegation without BC

SQLite implementation is currently WIP

* Fix: Avoid breaking changes on `AnyConnectionBackend`

* Refactor: Remove verbose `SqliteConnection` typing

* Feat: Implementation for SQLite

I have included `AtomicUsize` in `WorkerSharedState`. Ideally, it is not desirable to execute `load` and `fetch_add` in two separate steps, but we decided to allow it here since there is only one thread writing. To prevent writing from other threads, the field itself was made private, and a getter method was provided with `pub(crate)`.

* Refactor: Same approach for `cached_statements_size`

ref: a66787d36d62876b55475ef2326d17bade817aed

* Fix: Add missing `is_in_transaction` for backend

* Doc: Remove verbose "synchronously" word

* Fix: Remove useless `mut` qualifier

* feat: add Connection::begin_with

This patch completes the plumbing of an optional statement from these methods to
`TransactionManager::begin` without any validation of the provided statement.

There is a new `Error::InvalidSavePoint` which is triggered by any attempt to
call `Connection::begin_with` when we are already inside of a transaction.

* feat: add Pool::begin_with and Pool::try_begin_with

* feat: add Error::BeginFailed and validate that custom "begin" statements are successful

* chore: add tests of Error::BeginFailed

* chore: add tests of Error::InvalidSavePointStatement

* chore: test begin_with works for all SQLite "BEGIN" statements

* chore: improve comment on Connection::begin_with

* feat: add default impl of `Connection::begin_with`

This makes the new method a non-breaking change.

* refactor: combine if statement + unwrap_or_else into one match

* feat: use in-memory SQLite DB to avoid conflicts across tests run in parallel

* feedback: remove public wrapper for sqlite3_txn_state

Move the wrapper directly into the test that uses it instead.

* fix: cache Status on MySqlConnection

* fix: compilation errors

* fix: format

* fix: postgres test

* refactor: delete `Connection::get_transaction_depth`

* fix: tests

---------

Co-authored-by: mpyw <ryosuke_i_628@yahoo.co.jp>
Co-authored-by: Duncan Fairbanks <duncanfairbanks6@gmail.com>
2025-03-10 14:29:46 -07:00
Austin Bonander
8429f2e989 Merge remote-tracking branch 'origin/main' into sqlx-toml
# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	sqlx-cli/src/database.rs
#	sqlx-cli/src/lib.rs
#	sqlx-mysql/src/connection/executor.rs
2025-02-27 17:04:34 -08:00
Austin Bonander
1b0c64a9e9 chore(ci): test multi-tenant example 2025-02-27 17:00:37 -08:00
Austin Bonander
46878e8c0b feat: multi-tenant example
No longer Axum-based because filling out the request routes would have distracted from the purpose of the example.
2025-02-27 16:20:09 -08:00
joeydewaal
f42561b8d7
chore: expose bstr feature (#3714) 2025-02-04 10:53:05 -08:00
Austin Bonander
28b64509bd WIP feat: create multi-tenant database example 2025-01-26 01:00:46 -08:00
Austin Schey
aae800090b
feat(sqlite): add preupdate hook (#3625)
* feat: add preupdate hook

* address some PR comments

* add SqliteValueRef variant that takes a borrowed sqlite value pointer

* add PhantomData for additional lifetime check
2025-01-23 16:19:45 -08:00
Austin Bonander
e775d2a3eb refactor: make Config always compiled
simplifies usage while still making parsing optional for less generated code
2025-01-06 16:14:16 -08:00
Austin Bonander
afa3a930d2 feat: create sqlx.toml format 2025-01-06 16:14:14 -08:00
Austin Bonander
28cfdbb40c
Release/0.8.3 (#3663)
* chore: create 0.8.3 release

* fix: prevent dead-branch warning from Clippy in query macros

cc #3595

* fix: move `#[allow]` from previous commit to the `if` block
2025-01-03 20:28:57 -08:00
Ilya Bizyaev
35c78f5175
Support building with rustls but native certificates (#3551)
This adds an alternative TLS configuration that relies on rustls-native-certs,
for users who cannot bundle the MPL-licensed webpki-roots.

The approach is copied from reqwest:

* https://github.com/seanmonstar/reqwest/blob/3ad6e02cd/Cargo.toml#L48
* https://github.com/seanmonstar/reqwest/blob/3ad6e02cd/src/async_impl/client.rs#L513

— except error handling is relaxed to accommodate for tls_config.root_cert_path.
2024-11-27 16:39:18 -08:00
依云
5b8bb3b28b
Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library (#3507)
* Add a "sqlite-unbundled" feature that dynamically links to system libsqlite3.so library

* update README abouot the newly-added `sqlite-unbundled` feature

* Update README.md to make it clear with bulleted list

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

* more cfg feature updates

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

* update documentation in sqlx-sqlx/src/lib.rs too

and also mention possible build time increasement.

* cargo fmt

* Add "sqlite-unbundled" feature to sqlx-cli

* Add sqlite-unbundled to gituhb actions tests

* cfg(feature = "sqlite") => cfg(any(feature = "sqlite", feature = "sqlite-unbundled"))

* fix

* CI: make sqlite-unbundled tests workaround required-features

by duplicating the relevant test section

* use an internal "_sqlite" feature to do the conditional compilation

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2024-10-02 11:55:21 -07:00
John Vandenberg
063953fe60
chore: Update async-std v1.13 in lock file (#3491) 2024-09-08 21:52:59 -07:00
Austin Bonander
c253e65819 chore: prepare 0.8.2 release 2024-09-03 14:14:56 -07:00
Austin Bonander
998344dcb7 doc(FAQ): refine MSRV policy 2024-09-03 14:14:56 -07:00
Austin Bonander
9c94ce891a chore: prepare release 0.8.1 2024-08-24 00:17:41 -07:00
Austin Bonander
0aa06763e5 chore(mysql): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00
Austin Bonander
791433afbb chore(sqlite): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00
Austin Bonander
b1539b60a1 chore(postgres): create regression test for RUSTSEC-2024-0363 2024-08-23 23:39:32 -07:00
Austin Bonander
2ab7565bd8 chore: configure clippy cast lints at workspace level 2024-08-23 23:39:32 -07:00
Dirkjan Ochtman
a892ebc6e2
Upgrade to rustls 0.23 (#3399) 2024-08-04 16:39:13 -07:00
Frank Elsinga
49d5dd7f42
bumped to libsqlite3-sys=0.30.1 (#3382) 2024-07-27 17:59:00 -07:00
Austin Bonander
6651d2df72
Fix CI after Rust 1.80, remove dead feature references (#3381)
* fix(ci): update workflows/examples.yml

* Removed archived `actions-rs` actions
* Upgraded `Swatinem/rust-cache`, `actions/checkout`, `actions/download-artifact`, `actions/upload-artifact`

* chore: deprecate `AnyKind`

* fix: remove dead references to DB features in `sqlx-core`

This reactivates a couple of tests that had stopped working.

* chore(ci): move sqlx-cli checks to their own workflow

* fix(ci): remove remaining `uses: actions-rs/cargo`

* fix warnings

* chore: add titles to sqlx-cli jobs

* fix warnings (2)

* fix error in pool example

* fix warnings (3)

* fix query_builder test

* fix: don't run CLI tests on Windows

* chore: upgrade `rust-toolchain` to 1.80

* fix(postgres): fix missing Tokio specialization in `PgCopyIn`

Caught by the new `unexpected_cfgs` lint.

* fix new warnings
2024-07-26 23:15:32 -07:00
Yuta Kobayashi
f2fea27cba
Fix encoding and decoding of MySQL enums in sqlx::Type (#3371) 2024-07-25 02:47:36 -07:00
Austin Bonander
da0ffd7dcf chore: bump version to 0.8.0 2024-07-22 18:36:35 -07:00
Austin Bonander
c90a7fff49 fix: enable clock and std features of chrono for the workspace
fixes #3332
2024-07-22 18:36:35 -07:00
Frank Elsinga
b37b34bd04
chore:added a testcase for sqlx migrate add ... (#3352) 2024-07-19 18:50: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
Austin Bonander
16e3f1025a fix(postgres): add missing type resolution for arrays by name 2024-07-08 00:14:19 -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
Cody Casterline
352b02de6a
Bump libsqlite3-sys to v0.28 (#3148)
This includes SQLite v3.45(.1), which includes new JSONB functionality.
2024-03-30 15:59:51 -07:00
Luiz Carvalho
1c7b3d0751
feat: new derive feature flag (#3113)
* feat: new derive feature flag

* doc: add new derive flag to readme

* fix: macros feature flag cfg
2024-03-30 15:24:56 -07:00
Guilherme Favero Ferreira
c5357f18e5 bump bigdecimal version 2024-03-11 23:57:07 -07:00
Austin Bonander
30db1f8ffc chore: bump version to 0.8.0-alpha.0 2024-03-11 22:38:24 -07:00
Austin Bonander
248d6170a7 chore: prepare 0.7.4 release 2024-03-11 22:01:04 -07:00
Austin Bonander
e5c18b354e fix: gate sqlcipher testing behind cfg to make development less annoying 2024-03-05 18:33:56 -08:00
iamjpotts
235604fbce
chore(dev-deps): Upgrade env_logger from 0.9 to 0.11 (#3009)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-01-25 23:30:25 -08:00
iamjpotts
3946cc82db
chore(deps): Upgrade criterion to 0.5.1 (#3010)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-01-25 23:30:14 -08:00
iamjpotts
5890afe95b
chore(deps): Replace unmaintained tempdir crate with tempfile (#3006)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-01-22 20:16:06 -08:00
Austin Bonander
213ecd743c chore: upgrade libsqlite3-sys 2023-11-22 17:55:04 -08:00
Austin Bonander
31d402b469 chore: prepare 0.7.3 release 2023-11-22 17:43:46 -08:00
Austin Bonander
9fc9e7518e
feat: Text adapter (#2894) 2023-11-22 17:06:47 -08:00
A248
b1387057e5
Depend on version of async-std with non-private spawn-blocking (#2806) 2023-10-07 21:00:45 -07:00
Austin Bonander
e80291b2a7
chore: prepare 0.7.2 release (#2782) 2023-09-26 14:35:56 -07:00
Joakim Malmberg
8cad54cc9f
Add postgres chat exmaple (#2577)
Co-authored-by: Stephen <webmaster@scd31.com>
2023-07-24 16:09:06 -07:00
Austin Bonander
c70cfaf035
prepare 0.7.1 release (#2621) 2023-07-14 17:24:52 -07:00