diff --git a/Cargo.lock b/Cargo.lock index b0b52b53711f..816699488324 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,6 +164,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bit-vec" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4523a10839ffae575fb08aa3423026c8cb4687eef43952afb956229d4f246f7" + [[package]] name = "bitflags" version = "1.2.1" @@ -1908,6 +1914,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e634590e8812c500088d88db721195979223dabb05149f43cb50931d0ff5865d" dependencies = [ + "bit-vec", "bytes", "chrono", "fallible-iterator", @@ -2110,10 +2117,11 @@ dependencies = [ [[package]] name = "quaint" version = "0.2.0-alpha.9" -source = "git+https://github.com/prisma/quaint#3a4c5c287cafc79c08686d210b4bcf047fe35787" +source = "git+https://github.com/prisma/quaint#59891af32abfb911b59fb82f07ce1d50d20534f6" dependencies = [ "async-trait", "base64 0.11.0", + "bit-vec", "bytes", "chrono", "futures 0.3.4", diff --git a/query-engine/connectors/sql-query-connector/src/row.rs b/query-engine/connectors/sql-query-connector/src/row.rs index 29735c620034..a0cd49524134 100644 --- a/query-engine/connectors/sql-query-connector/src/row.rs +++ b/query-engine/connectors/sql-query-connector/src/row.rs @@ -6,7 +6,7 @@ use quaint::{ ast::{DatabaseValue, ParameterizedValue}, connector::ResultRow, }; -use rust_decimal::{prelude::FromPrimitive, Decimal}; +use rust_decimal::Decimal; use std::{borrow::Borrow, io, str::FromStr}; use uuid::Uuid; diff --git a/query-engine/prisma/src/tests/type_mappings/mysql_types.rs b/query-engine/prisma/src/tests/type_mappings/mysql_types.rs index 481c7e271128..d089fa137136 100644 --- a/query-engine/prisma/src/tests/type_mappings/mysql_types.rs +++ b/query-engine/prisma/src/tests/type_mappings/mysql_types.rs @@ -120,7 +120,7 @@ async fn mysql_types_roundtrip(api: &TestApi) -> TestResult { date_date: \"2020-02-27T00:00:00Z\" date_datetime: \"2020-02-27T19:10:22Z\" date_timestamp: \"2020-02-27T19:11:22Z\" - # date_time: \"2020-02-20T12:50:01Z\" + date_time: \"2020-02-20T12:50:01Z\" date_year: 2012 string_char: \"make dolphins easy\" string_varchar: \"dolphins of varying characters\" @@ -173,7 +173,7 @@ async fn mysql_types_roundtrip(api: &TestApi) -> TestResult { date_date date_datetime date_timestamp - # date_time + date_time date_year string_char string_varchar @@ -213,7 +213,7 @@ async fn mysql_types_roundtrip(api: &TestApi) -> TestResult { "date_date": "2020-02-27T00:00:00.000Z", "date_datetime": "2020-02-27T19:10:22.000Z", "date_timestamp": "2020-02-27T19:11:22.000Z", - // "date_time": "2020-02-27T19:11:22.000Z", + "date_time": "1970-01-01T12:50:01.000Z", "date_year": 2012, "string_char": "make dolphins easy", "string_varchar": "dolphins of varying characters", diff --git a/query-engine/prisma/src/tests/type_mappings/postgres_types.rs b/query-engine/prisma/src/tests/type_mappings/postgres_types.rs index fff12ef73890..5a87466847cc 100644 --- a/query-engine/prisma/src/tests/type_mappings/postgres_types.rs +++ b/query-engine/prisma/src/tests/type_mappings/postgres_types.rs @@ -29,7 +29,7 @@ const CREATE_TYPES_TABLE: &str = indoc! { string_text text, binary_bytea bytea, - binary_bits bit(80), + binary_bits bit(7), binary_bits_varying bit varying(80), binary_uuid uuid, @@ -129,6 +129,8 @@ async fn postgres_types_roundtrip(api: &TestApi) -> TestResult { string_char: "yeet" string_varchar: "yeet variable" string_text: "to yeet or not to yeet" + binary_bits: "0101110" + binary_bits_varying: "0101110" # binary_bytea: "test" binary_uuid: "111142ec-880b-4062-913d-8eac479ab957" time_timestamp: "2020-03-02T08:00:00.000" @@ -168,6 +170,8 @@ async fn postgres_types_roundtrip(api: &TestApi) -> TestResult { string_varchar string_text # binary_bytea + binary_bits + binary_bits_varying binary_uuid time_timestamp time_timestamptz @@ -213,6 +217,8 @@ async fn postgres_types_roundtrip(api: &TestApi) -> TestResult { "string_char": "yeet ", "string_varchar": "yeet variable", "string_text": "to yeet or not to yeet", + "binary_bits": "0101110", + "binary_bits_varying": "0101110", "binary_uuid": "111142ec-880b-4062-913d-8eac479ab957", "time_timestamp": "2020-03-02T08:00:00.000Z", "time_timestamptz": "2020-03-02T08:00:00.000Z", @@ -313,7 +319,7 @@ const CREATE_ARRAY_TYPES_TABLE: &str = indoc! { string_text text[], binary_bytea bytea[], - binary_bits bit(80)[], + binary_bits bit(8)[], binary_bits_varying bit varying(80)[], binary_uuid uuid[], @@ -384,6 +390,8 @@ async fn postgres_array_types_roundtrip(api: &TestApi) -> TestResult { string_char: { set: ["yeet"] } string_varchar: { set: ["yeet variable"] } string_text: { set: ["to yeet or not to yeet"] } + binary_bits: { set: ["10100011"] } + binary_bits_varying: { set: ["01000"] } binary_uuid: { set: ["111142ec-880b-4062-913d-8eac479ab957"] } time_timestamp: { set: ["2020-03-02T08:00:00.000"] } time_timestamptz: { set: ["2020-03-02T08:00:00.000"] } @@ -407,6 +415,8 @@ async fn postgres_array_types_roundtrip(api: &TestApi) -> TestResult { string_char string_varchar string_text + binary_bits + binary_bits_varying binary_uuid time_timestamp time_timestamptz @@ -438,6 +448,8 @@ async fn postgres_array_types_roundtrip(api: &TestApi) -> TestResult { "string_char": ["yeet "], "string_varchar": ["yeet variable"], "string_text": ["to yeet or not to yeet"], + "binary_bits": ["10100011"], + "binary_bits_varying": ["01000"], "binary_uuid": ["111142ec-880b-4062-913d-8eac479ab957"], "time_timestamp": ["2020-03-02T08:00:00.000Z"], "time_timestamptz": ["2020-03-02T08:00:00.000Z"],