link2xt
bd06836fba
test(sqlite): extend it_caches_statements() test
...
Test that initial PRAGMA statements and &str statements are not
cached, but sqlx::query() statements are cached by default.
2021-04-15 18:26:06 -07:00
Ryan Leckey
98cd619157
style: rustfmt
2021-04-09 00:24:14 -07:00
Alexander Krotov
78656eb469
fix(sqlite): reset the statement when fetch_many() stream is dropped
...
Unlike `Executor.fetch_optional()`, `Executor.fetch_many()` does not
have a single exit. The stream can be dropped at any time. To catch
this event, we create a `StatementResetter` structure inside the stream
loop and reset the statement when it is dropped.
A test case `it_resets_prepared_statement_after_fetch_many` is
similar to `it_resets_prepared_statement_after_fetch_one` which tests
`Executor.fetch_optional()`.
2021-04-09 00:23:17 -07:00
Ryan Leckey
fd828fed14
Merge remote-tracking branch 'demurgos/domain-type-description'
2021-04-08 23:59:25 -07:00
Diggory Blake
a3b73f8e08
Remove all listeners before returning a connection to the pool
2021-04-08 23:54:10 -07:00
Austin Bonander
5295ff10a5
fix: pool internals improvements
...
* fix `DecrementSizeGuard::drop()` only waking one `Waiter` regardless of whether that waiter was already woken
* fix connect-backoff loop giving up the size guard
* don't cut in line to open a new connection
* have tasks waiting on `acquire()` wake periodically to check if there's a connection in the queue
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-04-06 09:04:20 -07:00
crajcan
469c4ac130
Correct Postgres' Length Limit for Bind Parameters ( #1141 )
...
* Bump limit for postgres' bind parameters
* Fix lingering fmt error
2021-03-29 19:39:27 -07:00
Ryan Leckey
b6e1275617
fix: derive(Type) should emit a forwarded impl for the compatible function
2021-03-18 16:12:00 -07:00
Charles Samborski
93b90be9f7
fix(postgres): Add support for domain types description
...
Fix commit updates the `postgres::connection::describe` module to add full support for domain types. Domain types were previously confused with their category which caused invalid oid resolution.
Fixes launchbadge/sqlx#110
2021-03-16 20:23:03 +01:00
Austin Bonander
0ed524d65c
fix(pool): always ping connection on release to see if it's still viable
...
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-02-27 00:56:08 -08:00
Jonas Platte
2b2418c6d1
Add a test for nesting .map
2021-01-31 16:57:29 -08:00
Jonas Platte
7ebd362453
Update issue_104 test to use map instead of try_map
2021-01-31 16:57:29 -08:00
Austin Bonander
89305873b0
fix(postgres): patch nullable inference in Postgres using EXPLAIN
...
BREAKING CHANGE: some columns in `query!()` et. al. output will change from `T` to `Option<T>`
breakage should be minimal in practice as
these columns will need to have been manually
overridden anyway to avoid runtime errors
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2021-01-20 22:27:44 -08:00
Austin Bonander
6b036055e5
format: run rustfmt
2021-01-20 22:26:48 -08: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
Ryan Leckey
b0c430ed18
feat(sqlite): track nullable through left joins
2021-01-20 22:22:26 -08:00
Marcin Kaźmierczak
8328f893e4
sqlite test - prepared statements are reset after fetch_one
2021-01-20 22:10:59 -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
Jonas Platte
c5d43db312
Upgrade async runtime dependencies
...
Co-authored-by: Josh Toft <joshtoft@gmail.com>
Co-authored-by: Philip A Reimer <antreimer@gmail.com>
2021-01-20 21:50:45 -08:00
Jonas Platte
a1d562f04b
Remove the Done trait
2021-01-12 14:37:44 +01:00
Jonas Platte
fd0101afb2
Update some postgres trybuild tests
2021-01-12 03:39:10 -08:00
Jonas Platte
b3f78b8255
Add a trybuild test for sqlx(rename) deprecation warning
2021-01-12 03:39:10 -08:00
Jonas Platte
fd8b2b7f8a
Rename sqlx(rename) attribute to sqlx(type_name)
2021-01-12 03:39:10 -08:00
Ryan Leckey
e9e1dcf78e
style: rustfmt
2020-12-19 00:08:29 -08:00
Federico Rampazzo
c416c94d43
Fix escaping test query
2020-12-19 07:14:09 +00:00
Federico Rampazzo
3a7fe4da94
Fix more typos
2020-12-19 07:14:09 +00:00
Federico Rampazzo
0bb5e92836
Fix typo
2020-12-19 07:14:09 +00:00
Federico Rampazzo
05e42a8cac
Cargo fmt
2020-12-19 07:14:09 +00:00
Federico Rampazzo
b9e57de005
Rename mixedCase to camelCase, CamelCase to PascalCase, aligning with serde
2020-12-19 07:14:09 +00:00
Federico Rampazzo
00a999145f
Add mixedCase and CamelCase to rename-all, added rename-all to FromRow
2020-12-19 07:14:09 +00:00
Ryan Leckey
4f261b7346
test: added an explicit cast for bstr test where sqlite failed to do an implicit cast
2020-12-18 21:56:50 -08:00
Ryan Leckey
58618f62a2
fix(tests): update x.py with new runtime-* features
2020-12-18 21:33:51 -08:00
James Tomlinson
a959451e85
Add Sqlite Uuid type tests.
2020-12-18 21:33:49 -08:00
Josh Triplett
603c1950fe
Add tests for git2
2020-11-21 14:32:29 -08:00
Josh Triplett
d396e5a948
Add tests for bstr
2020-11-21 14:32:29 -08:00
Jonas Platte
a161bcba05
Rename cargo features in preparation for rustls support
2020-11-12 07:32:21 -08:00
David Yamnitsky
12b4250454
support sqlite bind parameters of the form $NNN
2020-11-06 15:08:08 -08:00
Julius de Bruijn
a0007b4e98
Fixing BigDecimal conversion for PostgreSQL
...
Now working properly with numbers, such as `0.01` and `0.012`.
2020-11-04 17:09:01 -08:00
Julius de Bruijn
333ee69f63
A test to reveal a bug with BigDecimal and PostgreSQL
2020-11-04 17:09:01 -08:00
dvermd
964837e255
Add #[derive(FromRow)] for tuple struct
2020-10-26 01:33:59 -07:00
Peter Maatman
5b7f3ab0e3
sqlite: Add test for JSON functions
2020-10-20 20:08:20 -07:00
Peter Maatman
fae72200e5
sqlite: Add basic json implementation
...
Fixes #608
2020-10-20 20:08:20 -07:00
Siddhant
65de83aff8
Fixed test cases
2020-10-20 15:13:18 -07:00
Siddhant
14191da283
Edited test cases to create and drop type
2020-10-20 15:13:18 -07:00
Siddhant
497f92f602
Added test cases for kebab-case enums
2020-10-20 15:13:18 -07:00
Austin Bonander
fa7981f68a
fix(pool): ignore spurious wakeups when waiting for a connection
...
fixes #622
2020-10-13 10:37:10 -07:00
Stuart Hinson
9b26d45344
application name test
2020-08-19 17:56:51 -07:00
Chloe Ross
3885ae6ddf
fix: allow queries that select just void to pass through macros as ()
instead of struct { _1: () }
2020-07-31 04:14:48 -07:00
Jannik Obermann
67142259e4
Fix #580 + Add test
2020-07-31 04:14:32 -07:00
Julius de Bruijn
1a59d3308a
Pg: Implementing BIT
and VARBIT
using BitVec
2020-07-27 03:36:44 -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
d06de149a0
fix: get MatchBorrow type check working for references 3 deep
2020-07-26 23:07:12 -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
55f6c9a2e9
test: fix decode test in macros
2020-07-26 18:11:15 -07:00
Ryan Leckey
f298eb3cf1
Merge remote-tracking branch 'raftario/embedded-migrations'
2020-07-26 18:03:59 -07:00
Ryan Leckey
86d41f17aa
Merge remote-tracking branch 'origin/ab/macro-refresh'
2020-07-26 17:54:23 -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
08d2c79279
feat(postgres): expose PgTypeKind
2020-07-24 07:28:59 -07:00
Danny Weinberg
f0f93c4f79
Fix options in tests
2020-07-24 07:25:29 -07:00
Danny Weinberg
036bd2a05d
Add SCREAMING_SNAKE_CASE rename_all option
...
This mirrors the addition of `uppercase` in https://github.com/launchbadge/sqlx/pull/304 , but for all uppercase snake case.
2020-07-24 07:25:29 -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
c9c11c8302
2-tier cache for Postgres
...
This solves a problem when needing to describe a query before executing
it, in cases where the query is more of a dynamic nature and binding its
parameters require the type info.
In this case, the first describe doesn't know the input parameters, so
the parameter type info is inferred from the database. In cases of
`varchar(10)[]` or `json` column types, the parameter type is inferred
to the column type. Now if we then try to use `text[]` or `jsonb` as the
types, the database has already stored different types for these
parameters for the statement, and will error out.
So we'll now only store the statement to the cache when it comes from an
actual execution of the 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
a27244b3c9
Make the test simpler for easier debug
2020-07-24 07:24:23 -07:00
Julius de Bruijn
a4dc3dfbd7
Add a test showing a bug in describe/execute combo
2020-07-24 07:24:23 -07:00
Julius de Bruijn
590f97df4a
Caching describe
2020-07-24 07:24:23 -07:00
Raphaël Thériault
435445fbd0
Edit migrator to make it possible to create static instances
2020-07-23 17:54:05 -04:00
Raphaël Thériault
92646e00b8
Fix migrate! and add migration test
2020-07-23 17:46:27 -04:00
Austin Bonander
94aa698581
refactor(macros): remove ResultExt and macro_result!()
2020-07-21 21:19:31 -07:00
Ryan Leckey
ee4d9b5412
fix(postgres): use the element type info from the protocol if available for array element decoding
...
fixes #537
2020-07-20 23:53:18 -07:00
Ryan Leckey
ae8800ccc4
feat(postgres): add () for VOID in macro resolution
2020-07-20 23:12:43 -07:00
Ryan Leckey
cd4e8dc1cb
feat(mysql): support configuring the active charset and collation (via an automatic SET NAMES)
2020-07-20 23:07:22 -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
14ecf5cbc4
test: make --target a prefix match and add --target-exact the old exact match
2020-07-18 03:26:55 -07:00
Ryan Leckey
9400a81cb0
test: switch tests/x.py to use host rustc for running tests
2020-07-18 03:18:25 -07:00
Ryan Leckey
f345c23e51
fix(mssql): handle multi-chunk packets
...
fixes #523
2020-07-17 06:08:36 -07:00
Ryan Leckey
9befdc81bf
test: add a regression test for the bugs discovered with #527
2020-07-17 04:56:58 -07:00
Ryan Leckey
fa40e9e55f
implement support for postgres TIMETZ type
...
Co-authored-by: Julius de Bruijn <julius+github@nauk.io>
2020-07-17 03:22:40 -07:00
Ryan Leckey
f4eb968c8d
test(sqlite): add DB parameter to Decode invocation
2020-07-17 03:22:40 -07:00
Ryan Leckey
6949b84e8c
style: rustfmt
2020-07-15 02:31:57 -07:00
Ryan Leckey
9b956c0d2c
fix(postgres): support the VOID type, as ()
2020-07-15 02:16:08 -07:00
Ryan Leckey
25b8fc7c04
fix(sqlite): support column types changing per row
2020-07-15 02:05:00 -07:00
Ryan Leckey
1247daec83
test: fix spurious ? in sqlite test
2020-07-14 08:52:42 -07:00
Ryan Leckey
54c857b448
fix some remaining usage of PoolOptions
2020-07-14 06:33:36 -07:00
Ryan Leckey
793f247604
refactor: PoolOptions::new() takes no parameters and the final .connect method takes the URI
2020-07-14 06:07:29 -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
OriolMunoz
993352e9d4
Support for #[sqlx(default)]
2020-07-12 03:57:17 -07:00
Mike Ledger
e731836e48
rust fmt wibble
2020-07-09 12:34:19 -07:00
Mike Ledger
03fcfc8562
concat test
2020-07-09 12:34:19 -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
Julius de Bruijn
e3b3806db5
Handle ParameterStatus
in PgStream
2020-07-06 05:56:10 -07:00
Ryan Leckey
41df13ba5a
test(postgres): fix unreliable test that depends on the sequence number
2020-07-05 04:40:13 -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
3b503a7764
feat(sqlite): clean up chrono support, add support for NaiveTime and NaiveDate
2020-07-04 05:51:46 -07:00
Ryan Leckey
7d22c0917f
Merge remote-tracking branch 'meteficha/felipesere-rebased'
2020-07-04 04:37:11 -07:00
agentsim
7810f7dcdd
Sqlite Collation Support ( #446 )
...
* Sqlite Collation Support
Adds a method create_collation to SqliteConnection.
Adds a unit test confirming the collation works as expected.
* Fix formatting
* Address feedback
Co-authored-by: Ryan Leckey <ryan@launchbadge.com>
2020-07-04 04:30:40 -07:00
Ryan Leckey
aaa8b25050
test(sqlite): add a couple macro expression tests
2020-07-04 04:13:53 -07:00
Ryan Leckey
d112c4d807
feat(sqlite): support expressions and multiple no-data statements in the macros
2020-07-04 04:06:43 -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
3a8dc0e211
fix(tests): prevent postgres::pool_smoke_test from starving executor
2020-07-03 05:59:20 -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
Julius de Bruijn
b3db51cdfc
Implement a proper type for money
2020-07-03 03:57:20 -07:00
Ryan Leckey
4c5ea7af77
Merge remote-tracking branch 'dimtion/pginterval'
2020-07-02 23:35:05 -07:00
Ryan Leckey
0b2844bf39
feat(any): implement ColumnIndex<AnyRow> for &str to enable FromRow for the Any driver
...
closes #464
2020-07-02 23:28:53 -07:00
Ryan Leckey
222cd688a4
feat(sqlite): enable configuration of journal_mode and foreign_keys and default to WAL and ON
2020-07-02 23:18:14 -07:00
Ryan Leckey
5d6516da68
fix: re-add MapRow and TryMapRow to fix HRTB normalization when more than one driver is in-use
2020-07-02 23:00:46 -07:00
Ryan Leckey
c7c46f237b
fix(sqlite): argument bind for sqlite is 1-indexed
...
fixes #467
2020-07-02 22:52:33 -07:00
Ryan Leckey
33ab2b9049
style: rustfmt
2020-07-02 22:38:23 -07:00
Ryan Leckey
1a7480774b
fix(postgres): after closing a statement, the connection should await CloseComplete
2020-07-02 22:37:04 -07:00
Peter Maatman
eda0b7dea4
mysql: Fix decoding of TIME '00:00:00.000000'
...
Fixes #418
2020-06-29 04:33:25 -07:00
Ryan Leckey
e4005bb53d
fix(mssql): handle errors without breaking the stream
2020-06-27 20:46:25 -07:00
Ryan Leckey
cfa833fa0d
fix(sqlite): fallback to storage class when typing expressions and infer INTEGER as i64
2020-06-27 19:17:46 -07:00
Loïc Carr
71cb68b2f4
feat(postgres) Create bindings for PgInterval
2020-06-27 17:36:06 -07:00
Felipe Lessa
c827c72808
FixedOffset for SQLite + Local test.
2020-06-27 21:59:49 +01:00
Felipe Lessa
f0adeae39e
Add sqlite chrono tests.
2020-06-27 12:08:16 +01:00
Ryan Leckey
a7117dd71b
feat(any): introduce the Any database driver which enables choosing the database driver at runtime
2020-06-27 04:07:40 -07:00
Felipe Lessa
364845e530
Update tests/sqlite/setup.sql to match current tests.
2020-06-27 09:11:02 +01:00
Ryan Leckey
7beceba832
fix(sqlite, test): column overrides still have runtime type checking, use the correct Rust type to match the sql type
2020-06-25 05:34:52 -07:00
Julius de Bruijn
2c2a277666
Caching methods in Connection
2020-06-25 10:44:05 +02:00
Julius de Bruijn
eba82e3fc1
LRU caching for SQLite
2020-06-24 19:46:32 +02:00
Julius de Bruijn
5d64310004
LRU caching for PostgreSQL
2020-06-24 19:01:54 +02:00
Julius de Bruijn
2b6f242a22
LRU statement cache for MySQL
2020-06-24 16:57:06 +02:00
Austin Bonander
36a53b44cd
fix(macros): don't emit typechecking code for explicit type overrides on bind params
2020-06-21 06:06:53 -07: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
7d3d708d92
chore(macros): add test for column overrides for SQLite
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
Austin Bonander
eb831382e5
feat(macros): type override annotations for columns
2020-06-21 06:06:53 -07:00
Ryan Leckey
efc4df3eea
test: state only version 3 for docker-compose
2020-06-21 04:35:28 -07:00
Ryan Leckey
8800a40979
test: tokio or actix should import tokio in pool_smoke_test
2020-06-21 04:34:29 -07:00
Ryan Leckey
9abdd7e408
style: rustfmt
2020-06-21 04:08:17 -07:00
Ryan Leckey
7c4c185698
chore: update dependencies
2020-06-21 03:55:31 -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
6cfe5ac811
refactor: tweak type name display to use TypeInfo::name
2020-06-21 03:55:31 -07:00
Daniel Akhterov
639e10248e
feat: add boolean support to sqlx-macros/mssql
2020-06-16 13:40:53 -07:00
Daniel Akhterov
80d545109b
feat: implement BIT
support in MSSQL
2020-06-15 22:49:33 -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
Caio
d4329e98d4
refactor: prepare to support postgres ranges
...
- Remove Type bound from Encode + Decode which removes the defaults
for produces() and accepts(). This allows custom type implementations
to be more flexible.
2020-06-12 15:33:19 -07:00