Commit graph

761 commits

Author SHA1 Message Date
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