Eric Semeniuc
389f9b5f41
fix macro
2020-12-18 21:33:52 -08:00
Eric Semeniuc
7cc0ecb981
Add cfg sqlite condition
2020-12-18 21:33:52 -08:00
Eric Semeniuc
c64b9bee45
Address pr feedback
2020-12-18 21:33:51 -08:00
Eric Semeniuc
892bbc95a9
add new example for migration
2020-12-18 21:33:51 -08:00
Ryan Leckey
187b7481e9
fix(sqlite): implement Encode on Uuid and Hyphenated not references to them
2020-12-18 21:33:50 -08:00
James Tomlinson
7c8822ae5e
Fix formatting (cargo fmt)
2020-12-18 21:33:30 -08:00
James Tomlinson
40011f66df
Uuid support for Sqlite.
...
Includes the same support for the Hyphenated adapter as the MySQL
Uuid support.
2020-12-18 21:33:30 -08:00
Andrew Whitehead
a445f9f431
manually close connections in SharedPool::close
2020-12-18 21:33:11 -08:00
Andrew Whitehead
f39d194b17
decrement pool size when connection is released
2020-12-18 21:33:11 -08:00
Chris Sosnin
4c1cf86380
sqlite: fix memory leak
2020-12-18 21:33:11 -08:00
Fangdun Cai
169fb298ef
fix: whoami crash on FreeBSD aarch platform
2020-12-18 21:33:11 -08:00
chertov
6f793271c4
Replace lru-cache with hashlink
2020-12-18 21:33:09 -08:00
Marcin Kaźmierczak
9ad0c71253
fix clipyy warnings
2020-12-18 21:32:08 -08:00
sid
0921df44c1
reversible migrations for cli
...
- adds a -r flag whihc will create a reversible migration
- add revert subcommand, which reverts the last migration
- add --dry-run flag to migration run command, which list the migrations that will be applied
- updates add migration to check if all migration are of same type, i.e cannot mix and match reversible and simple migrations
2020-12-18 21:32:08 -08:00
Marcin Kaźmierczak
e798409e20
fix fetch_optional for sqlite
2020-12-18 21:32:08 -08:00
Chris Sosnin
9747218ad3
postgres: fix decimal conversions
2020-12-10 22:22:33 +03:00
Chris Sosnin
82b66b29a3
Revert "Fixing BigDecimal conversion for PostgreSQL"
...
This reverts commit a0007b4e98
.
2020-12-10 22:02:01 +03:00
chertov
04647ae09a
Replace lru-cache with hashlink
2020-12-02 18:41:49 -08:00
alex.berger@nexiot.ch
8379728d6e
fix formatting
2020-11-27 17:58:05 +01:00
alex.berger@nexiot.ch
6ecdb83bc2
Add support for passing in-memory trusted certificates in addition to the already supported path to trusted certificates.
2020-11-27 17:43:24 +01:00
Marcin Kaźmierczak
7f1bff406d
fix clipyy warnings
2020-11-24 16:15:22 -08:00
sid
f41551f3ad
reversible migrations for cli
...
- adds a -r flag whihc will create a reversible migration
- add revert subcommand, which reverts the last migration
- add --dry-run flag to migration run command, which list the migrations that will be applied
- updates add migration to check if all migration are of same type, i.e cannot mix and match reversible and simple migrations
2020-11-24 16:04:43 -08:00
Marcin Kaźmierczak
70fa667063
fix fetch_optional for sqlite
2020-11-24 16:01:52 -08:00
Josh Triplett
71a72e7c67
Add support for git2::Oid (under the git2
feature flag)
...
This allows queries to convert between Oid and SQL data types.
2020-11-21 14:32:29 -08:00
Josh Triplett
47b0973bdb
Add support for bstr::BString (under the bstr
feature flag)
...
This allows queries to convert between BString and SQL data types.
2020-11-21 14:03:11 -08:00
Jonas Platte
c1e79d2675
Simplify pattern matching in postgres/type_info.rs
2020-11-19 14:04:07 -08:00
Jonas Platte
3c7c266eac
Fix some clippy lints
2020-11-19 14:04:07 -08:00
Ryan Leckey
0b03dc6762
prepare v0.4.0
2020-11-12 07:46:13 -08:00
Ryan Leckey
f22a3f5a5d
remove default runtime, you must now always select a runtime
2020-11-12 07:42:31 -08:00
Jonas Platte
1ed75ba5f0
Support accept_invalid_certs & accept_invalid_hostnames with rustls
...
Co-authored-by: BlackHoleFox <blackholefoxdev@gmail.com>
2020-11-12 07:32:59 -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
Jonas Platte
cd44b5eb43
De-duplicate mysql & postgres TLS code
2020-11-12 07:32:21 -08:00
Jonas Platte
a161bcba05
Rename cargo features in preparation for rustls support
2020-11-12 07:32:21 -08:00
Ryan Leckey
b8bce0a541
Merge branch 'mysql-non-ascii-credentials' of https://github.com/yerke/sqlx into yerke-mysql-non-ascii-credentials
2020-11-12 07:21:10 -08:00
Austin Bonander
cebfcce1b5
docs: WIP improve docs about Pool
...
Signed-off-by: Austin Bonander <austin@launchbadge.com>
2020-11-12 07:15:08 -08:00
Jakob Truelsen
9d71a7f372
Allow configuring the log level of query logging
2020-11-12 07:06:34 -08:00
David Yamnitsky
12b4250454
support sqlite bind parameters of the form $NNN
2020-11-06 15:08:08 -08:00
Yerkebulan Tulibergenov
b2ee575e4f
Merge branch 'master' into mysql-non-ascii-credentials
2020-11-04 22:50:03 -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
25e72925fa
Update to bigdecimal
0.2 and num-bigint
0.3
2020-11-04 17:09:01 -08:00
Marcin Kaźmierczak
1d9ab5245c
use futures_channel::oneshot in sqlite worker
2020-11-03 22:51:42 -08:00
Jonas Platte
85b5ab0fb3
Fix cfg-specific unused lints
2020-10-29 22:21:27 -07:00
Austin Bonander
e44031676f
doc: improve docs for Type
and FromRow
derives
2020-10-29 18:33:14 -07:00
dignifiedquire
eae3f46237
update libsqlite3-sys to 0.20
2020-10-26 01:34:28 -07:00
Peter Maatman
fae72200e5
sqlite: Add basic json implementation
...
Fixes #608
2020-10-20 20:08:20 -07:00
Daniel Stöckel
144dcceb44
fix(postgres): prefer parsing non-localized notice severity field
...
In order to support PostgreSQL <= 9.5, the b'S' field of an error/notice
message was parsed. However, this field can be localized and thus parsing
can fail for instances that use a non-english locale. In version > 9.5,
the b'V' field, that is guaranteed to be in english, was added. However,
even for these versions parsing would fail as the b'S' field was also
parsed. This patch prefers b'V' over b'S' if it exists and uses a default
severity in case b'V' is not present and b'S' could not be parsed.
Fixes #734
2020-10-19 00:03:06 -07:00
Dana Marcuse
d97014f620
feat: correctly handle percent-encoded socket as host for postgres URI
2020-10-18 01:19:11 -07:00
Dana Marcuse
7b1b8c12ba
feat: handle hostaddr postgres URI param and add more tests
2020-10-18 01:19:11 -07:00
Joshua Nelson
591d33b877
Enable all features for sqlx-core
on docs.rs
2020-10-17 02:44:53 -07:00
Joshua Nelson
20d65a8248
Remove hashbrown dependency
...
Hashbrown is now the hashmap used in the standard library, so no need to
pull in an external dependency. This switches to using `AHashMap`
directly.
2020-10-17 02:44:09 -07:00
Rodrigo Araujo
d69d897eab
Remove last line
2020-10-16 17:31:30 -07:00
Rodrigo Araujo
ce4b8caaa2
Format code
2020-10-16 17:31:30 -07:00
Rodrigo Araujo
f808a81f6c
TiDB compatibility: Add support to utf8mb4_bin collation
2020-10-16 17:31:30 -07:00
Jonas Platte
e1662e42e1
Fix unused variable warnings in migrate.rs with feature = "mssql"
2020-10-16 14:49:27 -07:00
Gevorg Hindoyan
5835bc4951
Fix NaiveDate parse_from_str argument order
...
The [documentation](https://docs.rs/chrono/0.4.13/chrono/naive/struct.NaiveDate.html#method.parse_from_str ) specifies that `NaiveDate::parse_from_str` takes two arguments: value and format, in respective order.
Due to this, `DATE` fields could not be read into `NaiveDate`... and I have ptsd.
2020-10-16 14:40:50 -07:00
Mike Cronce
fd25a7530c
sqlx-core/src/mysql/protocol/statement/execute.rs: Execute::encode_with(): Encode a 1 for iteration-count instead of 0
2020-10-15 22:51:08 -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
Julius de Bruijn
7a70717944
Use flags to detect MySQL enums
...
In some cases the returned value is of `ColumnType::String`, but it has
the `ENUM` flag set.
2020-10-13 10:09:06 -07:00
Jonas Platte
1935e91e7a
Bump base64 version
2020-10-13 10:04:05 -07:00
Jonas Platte
63bfab90c5
Bump hmac version
2020-10-13 10:04:05 -07:00
Jonas Platte
f155bb83e8
Bump hashbrown version
2020-10-13 10:04:05 -07:00
Joshua Nelson
920168a129
Add examples to after_connect
documentation
...
This requires testing with `--features postgres`.
2020-10-13 10:02:24 -07:00
Joshua Nelson
2be4601150
Add size()
and num_idle()
2020-10-13 09:57:56 -07:00
Kramer Hampton
d0ccb4d0b2
feat: parse additional parameters: user, password, port, dbname. Also
...
add additional documentation and an example connection string using
parameters.
2020-10-13 09:56:48 -07:00
Wesley Norris
727ebf0b38
Percent decode MySQL passwords from URL string
...
Fixes #603 .
Adds percent decoding for MySQL passwords for when they contain non-URL
safe passwords, along with a regression test to prevent further
instances of this issue.
2020-10-13 09:55:40 -07:00
Patryk Wychowaniec
ca07158949
sqlite: Fix #616
2020-10-13 09:54:50 -07:00
Jonas Platte
3b9c98d979
Fix bounds for F on query::Map
...
Query::map was not usable before.
2020-10-13 09:50:34 -07:00
Jonas Platte
4ad4a42edd
Make Send a supertrait of TryMapRow, MapRow
...
Map<'q, DB, F, A> where F: !Send was useless and these traits are only
used as part of Map. This might improve error messages.
2020-10-13 09:50:34 -07:00
Chris Couzens
8e4d061dc1
Correct PgConnectOptions to MySql in mysql docs
...
I'm using this library for the first time, and I noticed this small oversight in the docs.
2020-10-07 05:24:03 -07:00
David Yamnitsky
44594e2e03
impl From for AnyConnectOptions
2020-09-09 01:18:28 -07:00
Mike Cronce
1acd782e7f
sqlx-core/src/mysql/types/str.rs: cargo fmt
2020-09-02 22:53:13 -07:00
Mike Cronce
d8142a8fa3
sqlx-core/src/mysql/types/str.rs: str::compatible(): Added support for charset number 33 (utf8 COLLATE utf8_general_ci)
2020-09-02 22:53:13 -07:00
Andrew Whitehead
9cd9209aa3
add support for pooling in-memory sqlite DB, enabling shared cache
2020-09-02 22:51:03 -07:00
Yerkebulan Tulibergenov
b48e008ef8
Support non-ASCII chars in mssql credentials
2020-08-23 16:48:59 -07:00
Yerkebulan Tulibergenov
500d4a5b2a
Support non-ASCII chars in mysql credentials
2020-08-23 16:34:50 -07:00
Ryan Leckey
67099d993c
Merge remote-tracking branch 'frigus02/pg-percent-decode' into master
2020-08-19 18:03:31 -07:00
Stuart Hinson
1ab815cc9b
WIP pg application_name
2020-08-19 17:56:51 -07:00
Yusuke Tanaka
3076a2dc09
Fix typo
2020-08-17 20:39:52 -07:00
Jan Kuehle
106a6a8395
Support non-ASCII chars in postgres credentials
...
The `url` crate returns username and password portions of a URL as
percent encoded ASCII strings. In order to use them for the Postgres
connection, we need to decode them.
2020-08-13 15:50:07 +01:00
Julius de Bruijn
ae2e5db4b2
SQLite: Allow setting busy_timeout
in options
2020-08-04 19:16:31 -07:00
Chloe Ross
1949445cf0
other: don't deadname self
2020-07-31 04:14:48 -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
吴翱翔
96f4a43bb8
style: rustfmt
2020-07-29 07:39:31 -07:00
吴翱翔
c6fa9047b9
Remove rust_decimal unnecessary num-traits
2020-07-29 07:39:31 -07:00
Martin Tomasi
002929ed2e
Added missing target for query logger
2020-07-29 07:37:58 -07:00
Jonas Platte
960e71202b
Don't include postgres OIDs in query cache
2020-07-29 07:28:14 -07:00
foldu
bd1d9f45f3
Fix create_if_missing docs
2020-07-27 04:03:30 -07:00
Julius de Bruijn
0ed8e3f610
Add missing compatible
implementation for Vec<BitVec>
2020-07-27 03:36:44 -07:00
Julius de Bruijn
1a59d3308a
Pg: Implementing BIT
and VARBIT
using BitVec
2020-07-27 03:36:44 -07:00
Ryan Leckey
22f1f93b79
chore: prepare sqlx v0.4.0-beta.1 and sqlx-cli v0.1.0-beta.1
2020-07-27 01:43:02 -07:00
Ryan Leckey
7bc3133f70
feat: add an optional query logger (using log
)
2020-07-26 23:55:36 -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
Kaleb Elwert
e0ace861c5
Allow MigrationSource to be implemented externally ( #511 )
2020-07-26 20:23:44 -07:00
Joshua Koudys
05ffcb312d
Uuid support for MySQL ( #536 )
...
* feat: uuid decoder for mysql, patterned on postgres
* feat: Add uuid on mysql encoding
* fix: encode after converting to bytes
* fix: use the byte decoder on uuids
* fix: remove unused import
* feat: Adds mysql encoding/decoding support for Hyphenated uuid
* fix: uncommented feature flag line
* fix: unresolved import
* fix: use sqlx string type for binary uuid
Co-authored-by: Ian Hume <Humeian@me.com>
2020-07-26 19:45:06 -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
c454e1ea35
style: remove unused import
2020-07-26 18:05:55 -07:00
Ryan Leckey
f298eb3cf1
Merge remote-tracking branch 'raftario/embedded-migrations'
2020-07-26 18:03:59 -07:00
Ryan Leckey
b61c0821ab
style: rustfmt
2020-07-24 08:07:44 -07:00
Julius de Bruijn
8eb8661945
Allow decoding a YEAR
value as uint from MySQL
2020-07-24 08:05:54 -07:00
Ryan Leckey
40f0a22765
Merge remote-tracking branch 'magurotuna/doc-links'
2020-07-24 07:33:27 -07:00
Ryan Leckey
08d2c79279
feat(postgres): expose PgTypeKind
2020-07-24 07:28:59 -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
bfa29e521b
Implement Debug for statements
2020-07-24 07:24:23 -07:00
Julius de Bruijn
9839043b6d
Cache column and parameter info in mysql
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
8381e87d4a
Document migrate! (and small fixes)
2020-07-23 15:25:13 -04:00
Raphaël Thériault
e5e9665bd9
Add migrate! macro for embedded migrations
2020-07-23 14:22:50 -04:00
Raphaël Thériault
60c3ece671
Edit Migration and Migrator to make embedded migrations possible
2020-07-23 12:57:48 -04:00
Yusuke Tanaka
0890313259
doc: fix wrong links
2020-07-24 00:31:05 +09:00
Martin Risell Lilja
eba6f3973d
Remove sneaky 'println!' in sqlite chrono.
2020-07-23 03:36:27 -07:00
ABGH, C
dad1356147
Remove unused phf dependency
2020-07-22 17:58:23 -07:00
Ryan Leckey
e4dc040620
style: rustfmt
2020-07-20 23:53:36 -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
78fe88f51b
style: rustfmt
2020-07-20 23:12:52 -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
dc0d325738
fix: type annotate a conversion in mysql/str
2020-07-19 19:14:26 -07:00
Raphaël Thériault
41261862d3
Implement DerefMut and AsMut for Json
2020-07-18 21:55:13 -07:00
Ryan Leckey
cdd88b5338
feat: support ancient mysql versions (5.0+)
2020-07-18 21:43:05 -07:00
Ryan Leckey
49ffcf6f46
feat: add PgListener#try_recv to give users a chance to act on lost connection if desired
...
closes #447
2020-07-18 21:05:36 -07:00
Ryan Leckey
47772b0850
docs: add derive docs for sqlx::Type
2020-07-18 20:37:50 -07:00
Ryan Leckey
820618f396
test: fix some doctests under runtime-tokio
2020-07-18 03:27:05 -07:00
Ryan Leckey
9029a345e5
docs: add some module-level information sqlx::database
2020-07-18 03:13:41 -07:00
Ryan Leckey
f345c23e51
fix(mssql): handle multi-chunk packets
...
fixes #523
2020-07-17 06:08:36 -07:00
Ryan Leckey
6fdb0d534f
chore: update dependencies
2020-07-17 05:36:56 -07:00
Ryan Leckey
cc736df4d6
fix(postgres): use Sync over Flush for terminating extended non-query commands; in addition, keep better track of the number of expected readyForQueries
2020-07-17 04:56:39 -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
e285f0858f
refactor: split up postgres chrono/time modules
2020-07-17 03:22:40 -07:00
Ryan Leckey
e413cd6b0b
docs: fix links in FromRow docs
2020-07-17 03:22:40 -07:00
Julius de Bruijn
99b7017d6c
Conversion from BigDecimal
to PgMoney
2020-07-17 02:00:48 -07:00
OriolMunoz
f75891725f
FromRow derivation docs
2020-07-17 01:04:56 -07:00
Ryan Leckey
6949b84e8c
style: rustfmt
2020-07-15 02:31:57 -07:00
Ryan Leckey
b2ba00f4be
feat(macros): turn on support for JSON in mysql and arrays of JSON in postgres
2020-07-15 02:31:44 -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
dc5fc1b6c1
fix: do not enforce type equality if matching against the NULL type
2020-07-15 02:04:32 -07:00
Ryan Leckey
63f37a78c3
feat(sqlite): add SqliteConnectOptions::filename
2020-07-14 08:45:30 -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
8de2419b14
style: rustfmt
2020-07-14 05:05:50 -07:00
Ryan Leckey
47d566f5b6
feat: support Done for Any
2020-07-14 04:41:27 -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
8cf3ccc7e9
fix: put back transaction.open flag to stop auto-rollback
2020-07-12 04:42:37 -07:00
Ryan Leckey
d10f299c55
test: tweak in-code examples for latest refactors
2020-07-12 04:30:10 -07:00
Ryan Leckey
ff4dd4c7e7
fix: add a couple missing cfgs for the migrate feature
2020-07-12 04:15:37 -07:00
Joe Grund
d58f20f77a
Update column.rs
...
Skip serialization of `relation_id` and `relation_attribute_no` so they do not appear in `sqlx-data.json`
2020-07-12 03:54:47 -07:00
Ryan Leckey
61e4a4f566
feat: finish v1 of both cli and embedded migrations
2020-07-12 03:43:55 -07:00
Ryan Leckey
b920aa1c55
feat: support user-defined array and pseudo types in postgres
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
Julius de Bruijn
2e3e5187f9
Document better!
2020-07-09 12:32:19 -07:00
Julius de Bruijn
08f55bfc28
Simplify mantissa handling
2020-07-09 12:32:19 -07:00
Julius de Bruijn
47de479454
Conversions from Decimal
to PgMoney
2020-07-09 12:32:19 -07:00
Julius de Bruijn
e45e6d4173
Set the write part to use simpler math with u128
2020-07-09 12:32: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
95ac38caed
Add money conversions to Decimal
2020-07-09 12:32:19 -07:00
Julius de Bruijn
fd837fce09
Support for rust_decimal::Decimal
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
699df28088
test(postgres): remove usage of DataRow::len() in unit test
2020-07-05 04:37:53 -07:00
Ryan Leckey
15fc837366
fix: sqlite chrono type match after column metadata changes
2020-07-05 04:29:52 -07:00
Ryan Leckey
8baeb9215a
fix: correct a couple places from the recent column metadata changes
2020-07-05 04:28:25 -07:00
Ryan Leckey
250b4d8e10
feat(any): update Any to support the new column metadata
2020-07-05 04:23:10 -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
266a583a6b
fix: remove reference to accidentally added WIP module
2020-07-04 05:54: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
d112c4d807
feat(sqlite): support expressions and multiple no-data statements in the macros
2020-07-04 04:06:43 -07:00
Ryan Leckey
d209c60eb7
feat(sqlite): add read_only to SqliteConnectionOptions
2020-07-04 02:55:01 -07:00
Ryan Leckey
3c3356675e
fix(sqite): emit REAL for float columns in SQLite as the docs use that word a lot more
2020-07-04 02:54:41 -07:00
Austin Bonander
e2c707b447
fix: make Pool::try_acquire()
fair only when fair=true
in the options
2020-07-03 05:59:20 -07:00
Austin Bonander
15e0a5553a
chore: document PoolBuilder::fair()
2020-07-03 05:59:20 -07:00
Austin Bonander
17e88ac1a4
perf: implement pool benchmark, make fairness an option
2020-07-03 05:59:20 -07:00
Austin Bonander
8c2acaa258
fix(pool): prevent calls to acquire()
from cutting in line
...
add a few more checks for `is_closed`
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
83380eedbb
Renaming as_bigdecimal to to_bigdecimal.
...
Following the Rust guidelines
2020-07-03 03:57:20 -07:00
Julius de Bruijn
0a4de7038d
Remove the money compat functions from i64
2020-07-03 03:57:20 -07:00
Julius de Bruijn
744a4aa255
Make PgMoney
as Copy
2020-07-03 03:57:20 -07:00
Julius de Bruijn
b3db51cdfc
Implement a proper type for money
2020-07-03 03:57:20 -07:00
Julius de Bruijn
0c01ca966c
Support for money
type in Postgres
...
Reading is possible as `i64`, presenting the number of cents with the
default setting. The fractional precision depends on the `lc_monetary`
setting. By default the setting gives a fractional precision of 2.
Writing works with `i32`, `i64` or a numeric type such as `BigDecimal`.
When using an integer to write, it is not possible to represent cents.
Writing `123` to a money field stores a value of 12300.
When writing with a numeric type, cents can be represented. Reading
should still be done to an integer and if needed, converted to a numeric
type in the application to get the correct fractional precision.
2020-07-03 03:57:20 -07:00
Ryan Leckey
65222a62aa
style: rustfmt
2020-07-03 02:13:02 -07:00
Ryan Leckey
c82cf8f030
refactor(postgres, interval): clean up PgInterval a touch, remove any extra methods for now
2020-07-03 01:46:33 -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
20229ea2b9
fix: actually use TryMapRow and MapRow in Query
2020-07-02 23:03: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
1a7480774b
fix(postgres): after closing a statement, the connection should await CloseComplete
2020-07-02 22:37:04 -07:00
Julius de Bruijn
24d626b883
Reveal SQLite's extended error code
2020-07-01 09:33:18 -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
Ryan Leckey
513d666217
fix(any): support binding nulls in the any driver
2020-06-27 18:56:33 -07:00
Ryan Leckey
0b34545608
Revert "refactor: remove several blanket impls to allow more customization"
...
This reverts commit eb26e9f557
.
2020-06-27 18:54:50 -07:00
Ryan Leckey
f9d961ae1d
fix(any): rework decode and encode to not use blanket impls
2020-06-27 18:53:32 -07:00
Loïc Carr
523f650340
feat(postgres) Add support for std::time::Duration, time::Duration & chrono::Duration
2020-06-27 17:42: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
Austin Bonander
e2dabeeeee
fix: use correct io:Error
constructor in net/socket.rs
2020-06-27 11:15:11 -07:00
Ryan Leckey
518eb0c41a
chore: add any to all-databases and to each db test in CI
2020-06-27 06:04:30 -07:00
Ryan Leckey
4bb88e7da2
chore: update dependencies
2020-06-27 05:57:21 -07:00
Marcus Griep
816ea65c39
fix(mysql): improve compatibility with ProxySQL
...
Joins the MySQL connection setup statements into a single statement to
prevent issues with ProxySQL, which requires special handling of
connections that might be shared between multiple backends.
Fixes #422
Signed-off-by: Marcus Griep <marcus@griep.us>
2020-06-27 05:55:34 -07:00
Ryan Leckey
4989327c97
fix: remove cfg flag on .capacity
2020-06-27 05:51:03 -07:00
Julius de Bruijn
2115d02cb0
Move pg-specific socket options to its options.
...
Makes tcp connections explicit.
2020-06-27 05:34:23 -07:00
Julius de Bruijn
71ebeb9cc3
Remove warnings on mssql for statement cache
2020-06-27 05:34:23 -07:00
Julius de Bruijn
bcc42644e6
Do not do compile-time checks on pg socket
2020-06-27 05:34:23 -07:00
Julius de Bruijn
0ccfab1f25
Decide host
parameter between host and socket
...
- If starts with a leading `/`, use socket
- If not, use host
2020-06-27 05:34:23 -07:00
Julius de Bruijn
868dc3dd5b
MySQL UDS Support
...
- Adds support for Unix Domain Sockets on MySQL
- Allows setting the socket path in PostgreSQL connection options
- ... and MySQL connection options
2020-06-27 05:34:23 -07:00
Felipe Lessa
30faf73208
Use DATETIME for Sqlite chrono, fix parsing and docs.
...
The name DATETIME is used as an example by the SQLite documentation
(https://sqlite.org/datatype3.html#affinity ).
2020-06-27 12:22:27 +01:00
Ryan Leckey
6235eb5a5e
fix: StatementCache::capacity is only used by sqlite
2020-06-27 04:09:58 -07:00
Felipe Lessa
f0adeae39e
Add sqlite chrono tests.
2020-06-27 12:08:16 +01:00
Felipe Lessa
516af07713
Sqlite support for DateTime<{Utc,Local}>.
2020-06-27 12:08:00 +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
Ryan Leckey
62d02e9450
feat: implement Execute for (&str, Arguments)
2020-06-27 04:06:54 -07:00
Ryan Leckey
5091a28ce6
refactor: remove Default requirement for ArgumentBuffer
2020-06-27 04:06:35 -07:00
Ryan Leckey
b7ec7bbd3e
refactor: allow non-Send adding to arguments crate-local
2020-06-27 04:06:22 -07:00
Ryan Leckey
eb26e9f557
refactor: remove several blanket impls to allow more customization
2020-06-27 04:05:23 -07:00
Ryan Leckey
34859af1d3
feat(core): lift Send bound for arguments to Arguments::add
...
Execute already required Send so this just makes it fail earlier
2020-06-27 04:03:17 -07:00
Felipe Lessa
4254735dcf
Update sqlite chrono support so it compiles.
2020-06-27 09:12:33 +01:00
Felipe Sere
333803c1ff
Correct table headings and only list types that are actually implemented
2020-06-27 08:25:07 +01:00
Felipe Sere
7c27065c09
First attempt at roundtripping chrono types through SQLite
2020-06-27 08:25:05 +01:00
Ryan Leckey
991c0ba155
fix(sqlite): double negative in sqlite connection prepare
2020-06-25 05:34:14 -07:00
Ryan Leckey
8d1368f163
fix(sqlite): with caching disabled force persistent to false
...
additionally, set persistent to true for a cached statement and
correctly only reset the statement when its being reused
2020-06-25 03:44:26 -07:00
Ryan Leckey
8d24dfc0ef
feat(cache): expose capacity on StatementCache
2020-06-25 03:43:31 -07:00
Julius de Bruijn
363dbfb81e
No need to reset the statement when dropping.
2020-06-25 12:38:20 +02:00
Julius de Bruijn
745a32ab60
Close pg statements correctly
2020-06-25 12:26:44 +02:00
Julius de Bruijn
f969798cb6
Document new connection string params
2020-06-25 11:57:55 +02: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
Tim Murison
72c4e040bc
Require a mutable reference to self
2020-06-23 17:03:48 -07:00
Tim Murison
cac3f193d7
Adds a method get the underlying sqlite3 pointer
2020-06-23 17:03:48 -07:00
Zachery Gyurkovitz
84e8ed0d4c
fix: bigdecimal decoding ob1 for positive weight multiples of 4
2020-06-23 13:10:03 -07:00
Ryan Leckey
f85920acaf
fix(postgres): ignore more harmless messages in execute
2020-06-21 22:09:00 -07:00
Ryan Leckey
3dc067f031
fix: downgrade num-bigint due to conflicting version in rsa
2020-06-21 04:13:45 -07:00
Ryan Leckey
ec6b4be7fb
fix: rename Decode::accepts to Type::compatible for MSSQL / bool
2020-06-21 04:13:33 -07:00
Ryan Leckey
4448c0e629
feat: add should_flush and only spawn on drop for PoolConnection if we need to flush
2020-06-21 03:55:31 -07:00
Ryan Leckey
d76002e110
postgres: ignore more messages during execution if they are deemed not relevant
2020-06-21 03:55:31 -07:00
Ryan Leckey
f8dc7284b9
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
Ryan Leckey
93728a051c
fix: impl Deserialize for Json for MySQL instead of DeserializeOwned
2020-06-21 03:55:31 -07:00
Ryan Leckey
21717b47a0
fix: AsyncStream should use a zero-capacity stream to ensure we run in lock-step
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
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
11e21e201c
feat: add a name method to TypeInfo
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
Daniel Akhterov
80d545109b
feat: implement BIT
support in MSSQL
2020-06-15 22:49:33 -07:00
Bo Jeanes
956721c96c
Don't leak txns on explicit commit/rollback
...
Fixes #409
2020-06-14 20:03:50 -07:00
Ryan Leckey
e10c7c723f
refactor: remove impl of Encode::produces where it doesn't make sense
...
produces is meant as a value-dependent override, it only makes sense
currently for MSSQL or in generic contexts
2020-06-13 10:18:04 -07:00
Ryan Leckey
847e0b6b6b
fix(mysql): update usage of Digest and remove OAEP module in favor of the RSA crate
2020-06-13 08:55:24 -07:00
Ryan Leckey
c2ce35fc06
fix(postgres): update usage of Digest
2020-06-13 08:54:52 -07:00
Ryan Leckey
e2ac01e190
chore: update dependencies
2020-06-13 08:54:38 -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
Ryan Leckey
fedd883d91
style: rustfmt
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
Daniel Akhterov
98a0de2cfd
feat: implement Order
message type
2020-06-11 18:58:06 -07:00
Ryan Leckey
e9a562f89a
fix(mysql): handle MySQL sending more or less bytes than we expect for an integer type
2020-06-11 03:39:23 -07:00
Pirmin Kalberer
e5a7619344
Allow queries on virtual tables
2020-06-11 03:36:58 -07:00
Ryan Leckey
475ed9e1df
fix(mariadb): don't append UNSIGNED to the type of timestamp columns
2020-06-10 04:24:34 -07:00
Ryan Leckey
1dac0b5c29
fix(postgres): invert the type description logic to allow all "simple" type categories
...
closes #379
2020-06-10 04:21:09 -07:00
Ryan Leckey
e7d6e67f03
docs(pool): add some module docs to sqlx::pool
2020-06-10 01:51:14 -07:00
Ryan Leckey
ef6afb64d3
feat(pool): use Connect::Options over &str
2020-06-10 01:19:10 -07:00
Ryan Leckey
8359c01b76
fix(sqlite): set a busy timeout to handle SQLITE_BUSY
2020-06-10 01:02:41 -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
Ryan Leckey
6fcb520ac9
fix(mssql): emit nvarchar(max) if len is too large
2020-06-10 00:43:14 -07:00
Ryan Leckey
72ca9036c5
fix(mssql): potential stall on re-using connection after an dropped incomplete fetch stream
2020-06-10 00:43:14 -07:00
Peter Maatman
2a5ea2f71b
mysql: always use column alias when available
...
If a query has a column alias available we should use that name instead
of the column name.
Fixes #385
2020-06-10 00:42:58 -07:00
Ryan Leckey
ec1cfc11e6
refactor(core): rename try_stream2 to try_stream (after removal of conflicting async-stream package)
2020-06-09 23:15:54 -07:00
Ryan Leckey
65057f0e05
fix(core): add missing .await
in try_stream!
2020-06-09 23:15:19 -07:00
Ryan Leckey
e1d22a1840
fix(core): async-stream crate seems to lose the stream if the stream owns the object we are streaming
...
hand-rolled a copy of the idea behind AsyncStream and things seem to work
2020-06-09 02:16:47 -07:00
Ryan Leckey
e54d030381
fix(mysql): str should produce VARCHAR not BLOB
2020-06-08 02:30:21 -07:00
Ryan Leckey
9a7401a427
chore: update dependencies
2020-06-07 16:30:21 -07:00
Ryan Leckey
f2885f84a7
fix(mssql): handle NULL values
2020-06-07 16:30:07 -07:00
Ryan Leckey
a0ccc135aa
style(mssql): rename MsSql to Mssql as MSSQL is not written MsSQL
2020-06-07 05:39:12 -07:00
Ryan Leckey
c9eef8b030
fix(postgres): failure to detect errors on postgres 9.5
2020-06-07 05:09:51 -07:00
Ryan Leckey
53c074130f
Merge remote-tracking branch 'origin/ab/macro-fixes'
2020-06-07 02:35:12 -07:00
Daniel Akhterov
c050611bac
fix: remove DatebaseError impl for stringprep::Error and panic instead
2020-06-07 02:34:41 -07:00
Daniel Akhterov
362a546484
feat(postgres): make sure username is ran through saslprep before sending to server
2020-06-07 02:34:41 -07:00
流光
ebfd5eb4f8
fix bug in init_min_connections
2020-06-07 02:34:20 -07:00
Ryan Leckey
9233cb5812
fix(sqlite): minor typo when encode for Option<T> became a macro
2020-06-07 02:15:48 -07:00
Ryan Leckey
13598c0eeb
feat(mssql): add support for offline
2020-06-07 02:15:10 -07:00
Ryan Leckey
ef2527ff3e
feat(mssql): fix a few bugs and implement Connection::describe
2020-06-07 02:00:31 -07:00
Ryan Leckey
559169cc79
refactor(mssql): clean up unused imports and other warnings
2020-06-07 02:00:13 -07:00
Ryan Leckey
12c1137d91
feat(mssql): add support for f32 and f64
2020-06-07 02:00:13 -07:00
Ryan Leckey
28636c1f5d
feat(mssql): add support for string types including a framework for handling non-UTF8 data
2020-06-07 02:00:13 -07:00
Ryan Leckey
2a272bdd59
feat(mssql): setup type tests for MSSQL and add support for all the int types
2020-06-07 02:00:13 -07:00
Ryan Leckey
434bfaa76a
feat(mssql): handle stream flushing
2020-06-07 02:00:13 -07:00
Ryan Leckey
c64122c03f
feat(mssql): implement parameterized queries
2020-06-07 02:00:13 -07:00
Ryan Leckey
9a701313bc
feat(mssql): implement enough to get simple queries working
...
Co-authored-by: Daniel Akhterov <akhterovd@gmail.com>
2020-06-07 02:00:12 -07:00