1145 Commits

Author SHA1 Message Date
Marti Serra
3dec1d186a
Small doc correction. (#3755)
When sqlx-core/src/from_row.rs was updated to implement FromRow for tuples of up to 16 values, a comment was left stating that it was implemented up to tuples of 9 values.
2025-02-22 13:33:14 -08:00
Stefan Schindler
8dce6bd9e1
Fix example calculation (#3741) 2025-02-20 12:57:54 -08:00
Ethan Wang
b859914153
QueryBuilder: add debug_assert when push_values is passed an empty set of tuples (#3734)
* throw a warning in tracing so that the empty tuples would be noticed

* use debug assertion to throw a panic in debug mode
2025-02-17 17:39:40 -08:00
tottoto
3a20a92a3f
chore: replace rustls-pemfile with rustls-pki-types (#3725) 2025-02-05 13:48:19 -08:00
joeydewaal
f42561b8d7
chore: expose bstr feature (#3714) 2025-02-04 10:53:05 -08:00
Paolo Barbolini
65229f7ff9
Replace some futures_util APIs with std variants (#3721) 2025-02-01 16:01:56 -08:00
Tobias Bieniek
4d638c9e24
FromRow: Fix documentation order (#3712)
The `try_from` and `json` sections are "Field attributes" so they should probably be part of the corresponding section instead of subsections of "Manual implementation". `flatten` should be H4 instead of H3, since "Field attributes" is H3 and all other field attribute sections are H4 too.
2025-01-29 15:00:21 -08:00
Sean Aye
2aab4cd237
Add json(nullable) macro attribute (#3677)
* add json optional attribute parser and expansion

* rename attribute

* add test

* fix tests

* fix lints

* Add docs
2025-01-28 10:56:33 -08:00
Andreas Liljeqvist
a83395a360
Fix: nextest cleanup race condition (#3334)
* remove unused trait fn `cleanup_test_dbs`

* *wip* solve test cleanup race condition

* check for exactly 63 chars in database name

* move base64 dependency

* change

* Use url_safe base64 encoding

* Assert quoting for database name

* refactor

* add mysql support?

* borrow

* fix borrows

* ensure quoting

* re-add trait cleanup_test_dbs

* fix mysql insert

* cargo lock

* use actual field

* cleanup converted path in sqlite

* replace dashes with underscore in db name

* refactor: remove redundant path conversion in cleanup_test and add db_name method

---------

Co-authored-by: Austin Bonander <austin.bonander@gmail.com>
2025-01-23 17:36:55 -08:00
joeydewaal
f6d2fa3a3d
fix: handle nullable values by printing NULL instead of panicking (#3686) 2025-01-15 17:08:16 -08:00
Karam Barakat
b386862ed5 Update row.rs
Row::get should track caller for a better development experience.
2025-01-13 05:57:25 -08:00
Paolo Barbolini
7d148bd96b Bump hashbrown to v0.15 2024-12-24 01:52:20 -08:00
Paolo Barbolini
2b82ce3faa Bump hashlink to v0.10 2024-12-12 12:43:39 -08:00
joeydewaal
1f6ce33df4
chore: remove BoxFuture's (non-breaking) (#3629)
* chore: reduce BoxFuture's when using recursion.

* remove BoxFuture's in WithSocket

* chore: better document previous changes
2024-12-12 12:43:22 -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
XueHaonan
5c6623dee2
fix: fix example code of query_as (#3558)
query_as.rs: 230 mismatched bracket.
query_as.rs: 230 move TIMESTAMP to TIMESTAMPTZ to match type time::OffsetDateTime.
query_as.rs: 241, 251, 260 move i64 to i32 to match postgres type `INT4`.
2024-11-27 13:51:52 -08:00
Paolo Barbolini
3e8952b0d4
Bump thiserror to v2.0.0 (#3596) 2024-11-26 11:01:33 -08:00
Henri Sivonen
4fac945d5a
Remove default-features = false from url (#3601)
Fixes #3589.
2024-11-26 11:01:18 -08:00
Trevor
cadf152e99
fix: remove sqlformat (#3545)
* removed sqlformat from sql-core/src/logger.rs causing ref error to FormatOptions

* removed sqlformat from sql-core/src/logger.rs causing ref error to FormatOptions

---------

Co-authored-by: tbarnes <tbarnes@tbserver.tbarnes-server.local>
2024-10-04 21:34:18 -07: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
vsuryamurthy
293c55ce89 Remove unused dependencies from sqlx-core, sqlx-cli and sqlx-postgres 2024-09-24 18:46:31 -07:00
Austin Bonander
e10789d9d7
fix cancellation issues with PgListener, PgStream::recv() (#3467)
* fix(postgres): make `PgStream::recv_unchecked()` cancel-safe

* fix(postgres): make `PgListener` close the connection on-error

* fix: incorrect math in `BufferedSocket::read_buffered()`
2024-08-27 10:54:31 -07:00
Leon Lux
f69f370f25
Clarify usage of Json/Jsonb in query macros (#3447)
* add information and example on using json in query macros

* run cargo format

* add missing bracket to docs of json

* wrap docs in hidden async function

* change no_run to ignore
2024-08-24 15:59:40 -07:00
Austin Bonander
56d0225378 chore(postgres): include nullables query in error 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
Austin Bonander
9b3808b2d5 refactor: rename sqlx_core::io::{Encode, Decode} for clarity 2024-08-23 23:39:32 -07:00
Austin Bonander
9ec09fb789 fix: tests in sqlx-postgres 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
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
Leon Lux
940d9fb994
Add example on how to use Transaction as Executor (#3311)
* add example using Transaction as Executor to docs

* change tx.as_mut() to &mut *tx
2024-07-22 15:15:57 -07:00
SrGesus
eaad7b2c9a
doc: Minor rust docs fixes (#3312)
* Fixed some rust docs intra-doc non functioning links

* Minor tweaks

* Added warning for MSSQL not being functional yet

* Fixed requested changes

* Readded missing time

* Aligned table
2024-07-20 12:59:52 -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
Eric Torreborre
b71221cd74
use the persistent query setting with the Any driver (#3297) 2024-07-15 16:57:43 -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
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
Cristian Le
92de9d42a6 Add LICENSE-* files to crates 2024-06-20 10:56:08 -07:00
Austin Bonander
bae083cf79 fix: clippy warnings 2024-06-13 13:11:36 -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
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
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
Pmarquez
ceac70f7fa
fix: Option decoding in any driver (#3172) 2024-04-19 15:46:03 -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
Lev Kokotov
03926dec15
Fix unclean TLS shutdown (#3191)
* Fix dirty shutdown

* generic comment
2024-04-10 17:10:27 -07:00
Gnome!
3e7aa6bedf
Bump deps that do not need code changes (#3165) 2024-04-06 00:07:36 -07:00
Maciej Flak
45b5b61d7b
Add version information for failed cli migration (#3129) (#3130) 2024-04-04 21:45:21 -07:00
iamjpotts
d600ec0293
feat(logging): Log acquires from connection pool (#3073)
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
2024-04-01 19:35:50 -07:00
Austin Bonander
02c68a46c7
refactor: lift type mappings into driver crates (#2970)
Motivated by #2917
2024-03-30 15:52:52 -07:00
Bogdan Mircea
e0a1f1633c
Removed Send bound from arg binding (#2960) 2024-03-14 12:39:02 -07:00