Commit graph

162 commits

Author SHA1 Message Date
Peter Maatman
30d13174ea mysql: Add JSON support 2020-04-19 15:58:47 -07:00
Austin Bonander
f00b7b48e1 add regression test for Map::fetch() being Unpin 2020-04-13 14:17:37 -07:00
xiaopengli89
d50405743b add integration tests mysql-types.rs/decimal 2020-04-10 15:35:58 -07:00
Ryan Leckey
52408f3cbf test(postgres): make test_enum_type more resilient 2020-04-10 14:22:18 -07:00
Ryan Leckey
d360f682f8 fix(postgres): guarantee the type name on a PgTypeInfo to always be set
fixes #241
2020-04-10 13:37:08 -07:00
Ryan Leckey
b3fd720aad test(sqlite): add failing test to illustrate #231 2020-04-08 01:28:30 -07:00
sid
012c186069 support rename attribute in FromRow macro 2020-04-07 14:49:34 -07:00
Ryan Leckey
4dc634f8b5 postgres: add a test to prove Type derive works for structs and fix the issue with it
fixes #219
2020-04-01 16:40:04 -07:00
sid
40f11ebb77 Process keyword fields correctly in FromRow macro
This PR fixes the the incorrect handling of keywords fields of a struct in the FromRow macro.
Currently a struct with a field like 'r#type' will try to read values from a column with the exact same name with r# prefix. With this change this field will now map to a database column with the correct name 'type' without the r# prefix.
2020-03-30 19:30:50 +05:30
Ryan Leckey
5fa11da353 use sqlx_test over connect fn in test 2020-03-29 14:40:02 -07:00
Ryan Leckey
c59d7aeebe macro tests: update for null inferrence 2020-03-29 01:33:12 -07:00
Austin Bonander
fb50968ec7 update schema in SQLite test DB 2020-03-28 17:50:27 -07:00
Austin Bonander
4b51c16cce MySQL: tweak macro test a bit 2020-03-28 17:50:27 -07:00
Austin Bonander
4ffa7f0e01 SQLite: implement column nullability checking 2020-03-28 17:50:27 -07:00
Austin Bonander
6fde5a2579 implement nullability on macro output, test postgres 2020-03-28 17:50:27 -07:00
Oliver Bøving
bcb3959379
Add array of uuid, chrono, time, bigdecimal, and ipnetwork as well as JsonValue to query macro (#154)
* Add array of uuid, chrono, time, bigdecimal, and ipnetwork to query macro

* Comment out tests for arrays of BigDecimal

Currently arrays of BigDecimal doesn't in query macros compile.
As all of the other types work just fine, BigDecimal is simply omitted.

* Add serde_json::Value to query macros

This also adds serde_json as an optional dependency to sqlx_macros along
side a new json feature flag.
2020-03-28 17:28:47 -07:00
Ryan Leckey
2f80621279 Add query_as_unchecked! and query_file_as_unchecked! to use the macro system with unchecked input and output 2020-03-27 16:37:28 -07:00
Austin Bonander
e594a7fdca Postgres: don't cache failed statement 2020-03-27 15:54:28 -07:00
Ryan Leckey
3103d50be8 postgres: implement PgTypeInfo::with_name
- remove PgTypeInfo::with_oid
 - use a new PgRawBuffer type instead of Vec<u8> for encoding
2020-03-26 19:29:49 -07:00
Ryan Leckey
c6db69574b postgres: remove PgTypeInfo::type_name() 2020-03-26 19:16:54 -07:00
Austin Bonander
3436ede2d3 fix some remaining fallout from Result refactor 2020-03-25 22:33:03 -07:00
Ryan Leckey
2274b69556 postgres: support "CHAR" and OID 2020-03-25 04:46:17 -07:00
Ryan Leckey
50a9120efb mysql: use the correct integer width 2020-03-25 04:31:38 -07:00
Ryan Leckey
6049f976f9 opt out of compatible type check for null values 2020-03-25 04:25:38 -07:00
Ryan Leckey
7ab772ea80 postgres: simplify JSON support to just Json<T> 2020-03-25 04:20:35 -07:00
Ryan Leckey
ad2cf1676f mysql: tweak type equivalence rules to try and support both rust best practices but still be compatible with the loose types of mysql 2020-03-25 03:56:39 -07:00
Ryan Leckey
50928b06b8 mysql: implement type compatible checks 2020-03-25 03:24:43 -07:00
Ryan Leckey
129efcd367 implement a runtime type compatibility check before decoding values 2020-03-25 02:07:17 -07:00
Ryan Leckey
1dc582edd0 postgres: have PgValue remember its type OID
this is in preparation of doing type compatibility checks
2020-03-25 01:46:13 -07:00
Ryan Leckey
63aa3e8f0f add support for VARCHAR and BPCHAR in postgres 2020-03-24 12:49:52 -07:00
Ryan Leckey
f83e0296cc don't use now private module runtime in tests 2020-03-24 03:13:12 -07:00
Ryan Leckey
dcea3f0586 fix FromRow derive to take &Row 2020-03-24 03:08:58 -07:00
Ryan Leckey
3ecc2e06ba Run rustfmt (small issue in a test) 2020-03-23 21:24:28 -07:00
Ryan Leckey
7bfd37e888 Add a test for #[derive(FromRow)] both with and without a declared lifetime 2020-03-23 21:22:25 -07:00
Ryan Leckey
fc6e6a65f7 only run gated time tests if both time features are not present 2020-03-21 03:20:38 -07:00
Ryan Leckey
db543f8391 clean up Time impl, impl for text modes 2020-03-21 02:34:21 -07:00
Ryan Leckey
4a98a51a19 Merge remote-tracking branch 'utter-step/time-rs' 2020-03-21 01:25:00 -07:00
Ryan Leckey
05d8ac2747 Finish up JSON/JSONB support for Postgres
* implement for &serde_json::RawValue

 * sqlx::types::Json<T> is a common type that all JSON-compatible databases can implement for,
   postgres implements Json<T> as JSONB

 * sqlx::postgres::types::PgJson<T> resolves to JSON

 * sqlx::postgres::types::PgJsonB<T> resolves to JSONB
2020-03-21 01:16:34 -07:00
Oliver Bøving
b7e53e885a First draft of JSON/JSONB support for postgres
This introduces two new wrapper types `Json` and `Jsonb`, currently
exported by `sqlx::postgres::{Json, Jsonb}` and adds serde and
serde_json as optional dependencies, under the feature flag `json`.
Wrapping types in `Json[b]` that implement `serde::Deserialize` and
`serde::Serialize` allows them to be decoded and encoded respectivly.
2020-03-20 23:59:25 -07:00
Daniel Akhterov
cbdc1bbfb2 Refactor the error to be generic over database 2020-03-20 23:51:45 -07:00
Ryan Leckey
476b9308f2 Merge branch 'fetch-one-hang' of https://github.com/Freax13/sqlx into Freax13-fetch-one-hang 2020-03-20 20:10:02 -07:00
Ryan Leckey
ec27b65b26 postgres: change types in macros
Co-authored-by: Oliver Bøving <oliverboving@gmail.com>
2020-03-20 20:07:52 -07:00
Ryan Leckey
e42a995fd9 Extract a PgSequenceDecoder from ArrayDecoder and RecordDecoder and improve to support mutual nesting 2020-03-20 19:56:25 -07:00
Tom Dohrmann
b36bda1fc9 add test for fetch one messing up stream states 2020-03-20 21:05:25 +01:00
Ryan Leckey
f562e919b7 Merge branch '1d-array-pg-support' of https://github.com/oeb25/sqlx into oeb25-1d-array-pg-support 2020-03-20 10:11:02 -07:00
Ryan Leckey
50c3e5fefb
Merge pull request #138 from PoiScript/master
postgres: ipnetwork support
2020-03-20 09:54:43 -07:00
Tom Dohrmann
a944d99c1c support derives for sqlite 2020-03-20 10:21:15 +01:00
PoiScript
fb66cfa665 add ui tests for ipnetwork 2020-03-20 11:26:13 +08:00
PoiScript
9b6e1e089b add type test for ipnetwork 2020-03-20 11:10:58 +08:00
Ryan Leckey
9be1512833 mysql: use double literals in test 2020-03-18 23:16:56 -07:00