Yuri Astrakhan
a824e8468c
Cleanup format arguments ( #2650 )
...
Inlined format args make code more readable, and code more compact.
I ran this clippy command to fix most cases, and then cleaned up a few trailing commas and uncaught edge cases.
```
cargo clippy --bins --examples --benches --tests --lib --workspace --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2023-07-31 13:27:04 -07:00
Luiz Carvalho
3db16751a0
feat(sqlx-core): add table function to database error ( #2616 )
2023-07-14 10:37:02 -07:00
Luiz Carvalho
c09532864d
feat: better database errors ( #2109 )
...
* feat(core): create error kind enum
* feat(core): add error kind for postgres
* feat(core): add error kind for sqlite
* feat(core): add error kind for mysql
* test(postgres): add error tests
* test(sqlite): add error tests
* test(mysql): add error tests
* fix(tests): fix tests rebasing
* refac(errors): add `ErrorKind::Other` variant
2023-02-21 13:25:25 -08:00
Austin Bonander
b5312c3b6f
Break drivers out into separate crates, clean up some technical debt ( #2039 )
...
* WIP rt refactors
* refactor: break drivers out into separate crates
also cleans up significant technical debt
2023-02-21 13:25:25 -08:00
Austin Bonander
f02ff94e9c
refactor: pool fixes and breaking changes ( #1901 )
...
* Fixed leak of `Arc<SharedPool>` in `DecrementSizeGuard::cancel()`
* Renamed `PoolOptions::connect_timeout` to `acquire_timeout` for clarity.
* Fixed `/* SQLx ping */` showing up in Postgres query logs
* Made `.close()` a regular function that returns a `Future`
* Deleted deprecated method `PoolConnection::release()`
* Document why connection might be dropped if `Pool::acquire()` is cancelled
* Added connection metadata to pool lifecycle callbacks
* Improved guarantees for `min_connections`
* Fixed `num_idle()` to not spin forever at high load
* Improved documentation across the `pool` module
2022-06-16 12:56:28 -07:00
Paolo Barbolini
08296a28a0
Upgrade rustls to 0.20 ( #1505 )
...
* Upgrade rustls to 0.20
* Rustls 0.20.1 is out
* Fix merge conflict mistake
* Bump rustls-pemfile to 0.3
* Resync Cargo.lock
* Bump rustls-pemfile to v1
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2022-04-14 15:11:17 -07:00
Austin Bonander
63ca2ccc6c
refactor(sqlite): make background thread responsible for all FFI calls ( #1551 )
2021-12-29 15:23:02 -08:00
Luca Palmieri
34db44bffd
Mark the original DatabaseError as source. ( #1197 )
2021-07-23 16:31:49 -07:00
William Hammond
25858fc42a
Improves error handling in the case of missing type
2021-01-20 22:10:03 -08:00
Florian Hübsch
68cf2f9cdb
Add constraint method to DatabaseError trait
...
Override `constraint` method for `PgDatabaseError`.
2021-01-20 22:00:44 -08:00
Chloe Ross
2890d154a3
doc: use the fancy new intra-crate doc links everywhere
2021-01-04 18:39:03 -08:00
Jonas Platte
b14266ba2e
Add rustls support
2020-11-12 07:32:59 -08:00
Jonas Platte
9298c88b87
Refactor TLS code to be a bit easier to read
2020-11-12 07:32:21 -08:00
Patryk Wychowaniec
ca07158949
sqlite: Fix #616
2020-10-13 09:54:50 -07:00
Ryan Leckey
7b132d1dbc
refactor(mysql): store max_size in MySqlTypeInfo – prepare for an eventual future where emit bool for TINYINT(1)
2020-07-26 19:37:58 -07:00
Yusuke Tanaka
0890313259
doc: fix wrong links
2020-07-24 00:31:05 +09:00
Ryan Leckey
61e4a4f566
feat: finish v1 of both cli and embedded migrations
2020-07-12 03:43:55 -07:00
Ryan Leckey
e765287dba
refactor: restructure relationship between Pool, Connection, and Options
...
* Pool::new -> Pool::connect
* Add Pool::connect_lazy
* Pool::builder -> PoolOptions::new
* PoolConnection no longer implements Connection
* Transaction no longer implements Connection
* Add ConnectOptions::connect
* Add Acquire - abstract between &Pool and &mut Connection within one function
* Remove Connect, move connect to Connection
Co-authored-by: Austin Bonander <austin@launchbadge.com>
2020-07-12 03:43:55 -07:00
Ryan Leckey
aaa475cc33
refactor: move Decode::accepts to Type::compatible
2020-06-21 03:55:31 -07:00
Ryan Leckey
5ac7601fe2
docs: extend documentation on Encode/Decode
2020-06-21 03:55:31 -07:00
Ryan Leckey
e3adb88ab5
feat: disassociate Type from Decode further and require only Decode for FromRow + Row + Value
2020-06-21 03:55:31 -07:00
Ryan Leckey
c9f3e1adca
feat(postgres): add support for built-in range types and allow derives to handle custom range types
...
Co-authored-by: Caio <c410.f3r@gmail.com>
2020-06-12 15:33:19 -07:00
dignifiedquire
9b68eb19ef
fix(sqlx-macros): update trait definitions
2020-06-05 19:49:31 -07:00
Ryan Leckey
9b299d9f09
style(core): apply future-incompatible suggestions
2020-05-30 18:06:21 -07:00
Ryan Leckey
72c1f52caf
style(core): apply clippy suggestions
2020-05-30 18:00:21 -07:00
Ryan Leckey
e08f05b879
feat: re-introduce error downcasting
2020-05-30 17:51:56 -07:00
Ryan Leckey
757a930e21
refactor(core): remove the HRTB (higher rank trait bound) on Row in the aim of improving ergonomics
...
* removes the lifetime from Row
* removes MySqlQueryAs, SqliteQueryAs, etc. (no longer needed)
* introduce query_scalar
* introduce Decode::accepts to allow overriding runtime type checking
per-type (replaces TypeInfo::compatible)
* introduce Encode::produces to allow overriding the encoded type per-value
* adds a lifetime to Arguments (and introduce the HRTB HasArguments)
to support zero-copy encoding with SQLite
* renames Database::RawBuffer to HasArguments::ArgumentBuffer
* introduce Connect::connect_with to provide an ConnectOptions type
explicitly to opt-out of connection string parsing
* introduce Value and ValueRef traits to allow decoding-deferred
extraction of values from Rows
* introduce Encode::encode_by_ref and change Encode::encode to take
by-value to try and re-use memory where possible
* use thiserror to generate sqlx::Error
* [!] temporarily removes query logging
* [!] temporarily removes transactions
2020-05-30 16:09:08 -07:00
Austin Bonander
6fde5a2579
implement nullability on macro output, test postgres
2020-03-28 17:50:27 -07:00
Austin Bonander
e99a863288
remove now-unused imports and reformat
2020-03-25 21:37:11 -07:00
Austin Bonander
673f133cab
un-generify Error and support downcasting in DatabaseError
2020-03-25 18:13:56 -07:00
Ryan Leckey
6ebd5c8c1e
postgres: test type compatibility for record fields
2020-03-25 02:28:10 -07:00
Ryan Leckey
1940b685d3
fix warnings from rustdoc
2020-03-24 01:36:17 -07:00
Daniel Akhterov
cbdc1bbfb2
Refactor the error to be generic over database
2020-03-20 23:51:45 -07:00
Ryan Leckey
9973fa6357
Add decode_err! to help with formatted decode error generation
2020-03-20 19:55:00 -07:00
Ryan Leckey
1d0100b35d
Add DatabaseError::code
2020-03-16 18:29:41 -07:00
Ryan Leckey
68d4a0d258
sqlite: produce connection specific errors
...
postgres, mysql: use derive for Debug for error types
2020-03-15 02:14:23 -07:00
Ryan Leckey
c14338d329
remove unused imports
2020-03-11 02:29:20 -07:00
Ryan Leckey
7fbc26de05
tls: update tls module for postgres
2020-03-11 01:44:41 -07:00
Ryan Leckey
433aab1e5b
postgres: use RawValue in Decode and implement row-returning simple queries
2020-03-11 01:44:06 -07:00
Ryan Leckey
dd5f250e5e
decode: add lifetime to Decode; impl Decode for &str and &[u8]; remove DecodeError
2020-03-11 01:43:27 -07:00
Ryan Leckey
09f30067a0
Error::NotFound -> Error::RowNotFound and remove Error::FoundMoreThanOne
2020-03-11 01:43:27 -07:00
Ryan Leckey
817d07c081
Use non_exhaustive on sqlx::Error
2020-03-11 01:43:27 -07:00
Ryan Leckey
d981262e7e
row: RowIndex -> ColumnIndex and de-duplicate logic with macros
2020-03-11 01:43:27 -07:00
Jane Lusby
ea03fa47e7
Initial commit with doc_cfg changes
2020-01-22 13:10:10 -08:00
Ryan Leckey
0a5b527d79
fix import errors and run rustfmt
2020-01-14 10:35:50 -08:00
Austin Bonander
638852a2dd
implement TLS support for Postgres
2020-01-13 11:52:09 -08:00
Ryan Leckey
03251b719b
Refactor pool to fix liveness and consistently check
2020-01-11 01:02:03 -08:00
Ryan Leckey
98269ddd20
Fix several nits from Clippy and add back chrono support for MySql
2019-12-27 23:16:13 -08:00
Ryan Leckey
a23bfb60eb
Clean up the example a touch
2019-12-27 21:50:13 -08:00
Ryan Leckey
017ee38725
De-duplicate error impls and forward MySqlConnection/PgConnection to crate root
2019-12-27 21:50:13 -08:00