Commit graph

553 commits

Author SHA1 Message Date
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
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
Ryan Leckey
6235eb5a5e fix: StatementCache::capacity is only used by sqlite 2020-06-27 04:09:58 -07: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
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