Commit graph

59 commits

Author SHA1 Message Date
Thibs
c4130d45e3 Add client SSL authentication using key-file for Postgres, MySQL and MariaDB (#1850)
* use native-tls API

* Add client cert and key to MySQL connector

* Add client ssl tests for PostgreSQL

* Add client ssl tests for MariaDB and MySQL

* Adapt GA tests

* Fix RUSTFLAGS to run all tests

* Remove containers to free the DB port before running SSL auth tests

* Fix CI bad naming

* Use docker-compose down to remove also the network

* Fix main rebase

* Stop trying to stop service using docker-compose, simply use docker cmd

* Fix RUSTFLAGS for Postgres

* Name the Docker images for MariaDB and MySQL so we can stop them using their name

* Add the exception for mysql 5.7 not supporting compatible TLS version with RusTLS

* Rebase fixes

* Set correctly tls struct (fix merge)

* Handle Elliptic Curve variant for private key

* Fix tests suite

* Fix features in CI

* Add tests for Postgres 15 + rebase

* Python tests: fix exception for MySQL 5.7 + remove unneeded for loops

* CI: run SSL tests only when building with TLS support

---------

Co-authored-by: Barry Simons <linuxuser586@gmail.com>
2023-02-21 13:25:25 -08:00
Marco Cameriero
9f1f682285 Allow using complex types in try_from when deriving FromRow (#2115)
* Use `syn::Type` instead of `syn::Ident` to parse the value of `#[sqlx(try_from = "...")]`

* Fix broken test after rebase
2023-02-21 13:25:25 -08: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
Marco Neumann
5e56da87e0
fix: ensure migration progress is not lost for PG, mysql and sqlite (#1991)
* fix: ensure migration progress is not lost for PG

Fixes #1966.

* fix: ensure migration progress is not lost for sqlite

This is similar to #1966.

* fix: ensure reverse migration progress is not lost for PG

See #1966.

* fix: ensure reverse migration progress is not lost for sqlite

See #1966.

* fix: ensure migration progress is not lost for mysql

This is similar to #1966.

* fix: ensure reverse migration progress is not lost for mysql

See #1966.

* test: check migration type as well

* test: extend migrations testing

* fix: work around MySQL implicit commits

* refactor: simplify migration testing
2022-09-12 17:52:04 -07:00
zz
ddffaa7dde
feat: Add try_from attribute for FromRow (#1081) 2022-09-06 21:04:11 -07:00
Austin Bonander
054f61980a
feat: implement testing utilities (#2001) 2022-08-02 14:38:12 -07:00
Austin Bonander
a2eceec33b
chore: replace dotenv with dotenvy (#2003)
* chore: replace `dotenv` with `dotenvy`

The former appears to be unmaintained and the latter is a drop-in replacement.

* chore: fix all warnings
2022-07-28 14:33:44 -07:00
Paolo Barbolini
ec15f6b30c
Update uuid crate to v1 (#1821) 2022-04-20 12:48:29 -07:00
Paolo Barbolini
ba123e62fa
Update time to 0.3.2 (#1455)
Co-authored-by: Tyler Hill <tyhi@tyhi.rs>
2022-04-14 15:11:46 -07:00
Austin Bonander
d25ab07f21
fix(test): fix mismatched type error in MySQL type tests (#1517)
* fix new warning about trailing semicolon in expression macros

* fix(test): fix mismatched type error in MySQL type tests
2021-10-26 13:45:46 -07:00
Kohei Suzuki
593364f801
fix(mysql): handle multiple waiting results correctly (#1439)
* test(mysql): add test case for pending rows and dropped transaction

* fix(mysql): handle multiple waiting results correctly
2021-09-22 13:39:56 -07:00
Atkins
9f7205e80f
Fix GitHub Actions and integration test (#1346)
* fix test suite

* rustfmt

* need Row

* test: fix integration test scripts and update the upstream supported databases

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* ci(actions): update supported databases

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* ci(actions): use `pg_isready` instead of `sleep` to avoid error cause by database not ready

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* feat(core): add `trait PgConnectionInfo` for connection parameter status from server

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* test(postgres): fix integration test for postgres

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* test(mysql): fix integration tests

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* ci(actions): test database against the oldest and newest supported versions

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

* docs(core): document `trait PgConnectionInfo`

Signed-off-by: Atkins Chang <atkinschang@gmail.com>

Co-authored-by: Montana Low <montanalow@gmail.com>
2021-07-28 14:00:34 -07:00
Austin Bonander
7c32928ebc
feat(macros): implement query_scalar!() and variants
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-01-20 22:23:04 -08:00
Jonas Platte
a1d562f04b
Remove the Done trait 2021-01-12 14:37:44 +01:00
Jonas Platte
a161bcba05 Rename cargo features in preparation for rustls support 2020-11-12 07:32:21 -08:00
Austin Bonander
fa7981f68a fix(pool): ignore spurious wakeups when waiting for a connection
fixes #622
2020-10-13 10:37:10 -07:00
Ryan Leckey
27c67752f3 test(mysql): remove failing part of boolean describe test - not easily possible to fix in 0.4 2020-07-27 01:11:11 -07:00
Raphaël Thériault
ced09e0545
Support using both nullability and type overrides (#549)
* Make it possible to use both nullability and type overrides

* Fix override parsing lookahead logic

* Update column override tests

* Support nullability overrides with wildcard type overrides

* Fix tests

* Update query! overrides docs

* Remove last bits of macro_result!

* rustfmt
2020-07-27 00:43:35 -07:00
Ryan Leckey
3d7ac03e52 style: rustfmt 2020-07-26 22:30:45 -07:00
Ryan Leckey
4fec7db789 test(mysql, uuid): add some tests to prove UUIDs work in MySQL 2020-07-26 22:30:32 -07:00
Ryan Leckey
ec0e84d8ac feat(mysql): support reading and writing BIT via unsigned integers
e.g., BIT(64) is u64 and BIT(2) is u8
2020-07-26 19:42:32 -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
Ryan Leckey
b61c0821ab style: rustfmt 2020-07-24 08:07:44 -07:00
Ryan Leckey
3840d031c6 test: add a test case for YEAR support (as u16) 2020-07-24 08:07:07 -07:00
Ryan Leckey
e575501a39 feat: add Executor::prepare, a hook into the automatic statement preparation life-cycle 2020-07-24 07:24:23 -07:00
Julius de Bruijn
e8a4c54ac7 Allow setting caching per-query 2020-07-24 07:24:23 -07:00
Julius de Bruijn
0c9bea4ab2 Fixing panics for disabled statement cache 2020-07-24 07:24:23 -07:00
Julius de Bruijn
590f97df4a Caching describe 2020-07-24 07:24:23 -07:00
Ryan Leckey
cf78472d6d fix(mysql): gate com_stmt_execute encode on non-empty params, not non-null params 2020-07-20 21:49:30 -07:00
Ryan Leckey
96b76dc737 update todo examples to 0.4 and use migrations
* update tests/x.py

 * add examples/x.py
2020-07-18 05:43:16 -07:00
Ryan Leckey
54c857b448 fix some remaining usage of PoolOptions 2020-07-14 06:33:36 -07:00
Ryan Leckey
00137d4a04 feat: add sqlx::Done and return from Executor::execute()
+ Done::rows_affected()

 + Done::last_insert_id()
2020-07-14 04:31:25 -07:00
Ryan Leckey
93cab2a197 test: more pool usage adjustments 2020-07-12 05:02:40 -07:00
Ryan Leckey
fc682fa991 fix: adjust pool usage in tests and examples 2020-07-12 04:42:48 -07:00
Julius de Bruijn
f246d41aed Fixed an overflow with a negative scale 2020-07-09 12:32:19 -07:00
Julius de Bruijn
245d53e484 Test Decimal conversions in my and pg 2020-07-09 12:32:19 -07:00
Ryan Leckey
8d188c5f1a feat: expose column information on Row
- add database-specific Column types: MySqlColumn, PgColumn, etc.
 - add Row::columns() -> &[DB::Column]
 - add Row::column(I) and Row::try_column(I)
2020-07-05 03:48:36 -07:00
Ryan Leckey
0def87b689 fix(derives): lift requirement of Copy + Clone on weak enums 2020-07-04 03:14:42 -07:00
Ryan Leckey
6a251efb65 fix(mysql): enum type derive and column overrides need to deref before eq 2020-07-04 02:59:56 -07:00
Ryan Leckey
0824723765 fix: handle zero dates in MySQL, emit as Option::None (treat as NULL) 2020-07-03 05:50:06 -07:00
Peter Maatman
eda0b7dea4 mysql: Fix decoding of TIME '00:00:00.000000'
Fixes #418
2020-06-29 04:33:25 -07:00
Julius de Bruijn
2c2a277666 Caching methods in Connection 2020-06-25 10:44:05 +02:00
Julius de Bruijn
2b6f242a22 LRU statement cache for MySQL 2020-06-24 16:57:06 +02:00
Austin Bonander
f2515e2472 feat(macros): support nullable column override 2020-06-21 06:06:53 -07:00
Austin Bonander
029ba24cad chore(macros): add tests for bind parameter overrides 2020-06-21 06:06:53 -07:00
Austin Bonander
1a250976ba chore(macros): add test for column overrides for MySQL 2020-06-21 06:06:53 -07:00
Ryan Leckey
e7e2f5b37a fix: implement transparent Serialize and Deserialize for Json<_> 2020-06-21 03:55:31 -07:00
Peter Maatman
90242494a8 test: expose missing trait bounds for Json<Vec<x>> 2020-06-21 03:55:31 -07:00
Ryan Leckey
a2c55b9f31 fix(mysql): tweak JSON type so it accepts BINARY in addition to CHAR (and make tests pass in MySQL 5.5) 2020-06-10 00:43:14 -07:00