From 2e375ceae6e589bbb96d36528401a868324f21fa Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 19:13:56 -0500 Subject: [PATCH 01/16] frameworks/rust/mysql_async/src/Cargo.toml: Update mysql_async and tokio --- frameworks/rust/mysql_async/src/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/rust/mysql_async/src/Cargo.toml b/frameworks/rust/mysql_async/src/Cargo.toml index e825991e..0c949b55 100644 --- a/frameworks/rust/mysql_async/src/Cargo.toml +++ b/frameworks/rust/mysql_async/src/Cargo.toml @@ -5,9 +5,9 @@ authors = ["Mike Cronce "] edition = "2018" [dependencies] -mysql_async = "0.24" +mysql_async = "0.27" tablefy = "0.1" tablefy_derive = "0.2" -tokio = "0.2" +tokio = {version = "1", features = ["macros", "rt-multi-thread"]} prettytable-rs = "0.8" From 2d620e9d013a90ca47ee51b7e946473c0cae9d71 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 19:35:53 -0500 Subject: [PATCH 02/16] frameworks/rust/mysql_async/Dockerfile: Fix build in more recent cargo versions --- frameworks/rust/mysql_async/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/rust/mysql_async/Dockerfile b/frameworks/rust/mysql_async/Dockerfile index 6ffaf3b5..13dae30b 100644 --- a/frameworks/rust/mysql_async/Dockerfile +++ b/frameworks/rust/mysql_async/Dockerfile @@ -5,8 +5,7 @@ WORKDIR /src # Cache a layer with all the dependencies built RUN mkdir src && echo 'fn main() {}' > src/main.rs && cargo build && rm -Rvf src ADD src/src /src/src -RUN cargo build -ENTRYPOINT ["/src/target/debug/mysql-test"] +RUN touch src/main.rs && cargo build FROM fedora:32 COPY --from=builder /src/target/debug/mysql-test / From 67a37677e5373593294c236adaf065efe3a239ce Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 19:39:19 -0500 Subject: [PATCH 03/16] frameworks/rust/mysql_async/src/src/main.rs: Add test case representing prisma-engines failure against vttestserver:mysql80 --- frameworks/rust/mysql_async/src/src/main.rs | 102 ++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index e0c4d2b1..bc661beb 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -17,6 +17,73 @@ struct Payment { account_name: Option } +#[derive(Clone, Debug, PartialEq, Eq, Tablefy)] +struct ColumnInfo { + column_name: String, + data_type: String, + full_data_type: String, + character_maximum_length: Option, + numeric_precision: u8, + numeric_scale: u8, + datetime_precision: Option, + column_default: Option, + is_nullable: String, + extra: String, + table_name: String +} + +impl FromRow for ColumnInfo { + fn from_row_opt(row: Row) -> core::result::Result { + Ok(Self::new( + row.get(0).unwrap(), + row.get(1).unwrap(), + row.get(2).unwrap(), + row.get(3).unwrap(), + row.get(4).unwrap(), + row.get(5).unwrap(), + row.get(6).unwrap(), + row.get(7).unwrap(), + row.get(8).unwrap(), + row.get(9).unwrap(), + row.get(10).unwrap() + )) + } +} + +impl ColumnInfo { + fn new(column_name: String, data_type: String, full_data_type: String, character_maximum_length: Option, numeric_precision: u8, numeric_scale: u8, datetime_precision: Option, column_default: Option, is_nullable: String, extra: String, table_name: String) -> Self { + Self{ + column_name, + data_type, + full_data_type, + character_maximum_length, + numeric_precision, + numeric_scale, + datetime_precision, + column_default, + is_nullable, + extra, + table_name + } + } + + fn new2(column_name: &str, data_type: &str, full_data_type: &str, character_maximum_length: Option, numeric_precision: u8, numeric_scale: u8, datetime_precision: Option, column_default: Option<&str>, is_nullable: &str, extra: &str, table_name: &str) -> Self { + Self::new( + column_name.to_string(), + data_type.to_string(), + full_data_type.to_string(), + character_maximum_length, + numeric_precision, + numeric_scale, + datetime_precision, + column_default.map(|s| s.to_string()), + is_nullable.to_string(), + extra.to_string(), + table_name.to_string() + ) + } +} + #[tokio::main] async fn main() { let host = std::env::var("VT_HOST").unwrap(); @@ -152,5 +219,40 @@ async fn main() { Ok(_) => panic!("SELECT after DROP succeeded when it should have failed"), Err(e) => println!("Error (as expected):\n\t{}\n\n", e) }; + + let query = r" + CREATE TABLE `a` ( + `one` int NOT NULL, + `two` int NOT NULL, + PRIMARY KEY (`one`,`two`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci + "; + println!("--- query:{}", query); + conn.query_drop(query).await.expect("CREATE TABLE `s` failed"); + + let query = r" + SELECT + column_name column_name, + data_type data_type, + column_type full_data_type, + character_maximum_length character_maximum_length, + numeric_precision numeric_precision, + numeric_scale numeric_scale, + datetime_precision datetime_precision, + column_default column_default, + is_nullable is_nullable, + extra extra, + table_name table_name + FROM information_schema.columns + WHERE table_schema = ? + ORDER BY ordinal_position + "; + println!("--- query:{}", query); + let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); + //, vec![std::env::var("VT_DATABASE").unwrap()]).await + let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("SELECT from information_schema.columns failed"); + assert_eq!(rows.len(), 2); + assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int", None, 10, 0, None, None, "NO", "", "a")); + assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int", None, 10, 0, None, None, "NO", "", "a")); } From 16ce56ec2bcb1a0a75279f7642751da54e48b073 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 20:32:19 -0500 Subject: [PATCH 04/16] frameworks/rust/mysql_async/src/src/main.rs: rm COLLATE clause from final CREATE TABLE --- frameworks/rust/mysql_async/src/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index bc661beb..ad97f586 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -225,7 +225,7 @@ async fn main() { `one` int NOT NULL, `two` int NOT NULL, PRIMARY KEY (`one`,`two`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 "; println!("--- query:{}", query); conn.query_drop(query).await.expect("CREATE TABLE `s` failed"); From 3021c18ef4b25a0079cd3a082ff58cdd87c211f4 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 20:40:02 -0500 Subject: [PATCH 05/16] frameworks/rust/mysql_async/src/src/main.rs: Fix column_type values in information_schema test case --- frameworks/rust/mysql_async/src/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index ad97f586..96f0fa0f 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -252,7 +252,7 @@ async fn main() { //, vec![std::env::var("VT_DATABASE").unwrap()]).await let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int", None, 10, 0, None, None, "NO", "", "a")); - assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int", None, 10, 0, None, None, "NO", "", "a")); + assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, 10, 0, None, None, "NO", "", "a")); + assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, 10, 0, None, None, "NO", "", "a")); } From a34b85fa85b0c15f25d29be0f67382348db41d2d Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 21:05:47 -0500 Subject: [PATCH 06/16] frameworks/rust/mysql_async/src/src/main.rs: Made ColumnInfo::numeric_precision and ColumnInfo::numeric_scale optional --- frameworks/rust/mysql_async/src/src/main.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 96f0fa0f..38695c86 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -23,8 +23,8 @@ struct ColumnInfo { data_type: String, full_data_type: String, character_maximum_length: Option, - numeric_precision: u8, - numeric_scale: u8, + numeric_precision: Option, + numeric_scale: Option, datetime_precision: Option, column_default: Option, is_nullable: String, @@ -51,7 +51,7 @@ impl FromRow for ColumnInfo { } impl ColumnInfo { - fn new(column_name: String, data_type: String, full_data_type: String, character_maximum_length: Option, numeric_precision: u8, numeric_scale: u8, datetime_precision: Option, column_default: Option, is_nullable: String, extra: String, table_name: String) -> Self { + fn new(column_name: String, data_type: String, full_data_type: String, character_maximum_length: Option, numeric_precision: Option, numeric_scale: Option, datetime_precision: Option, column_default: Option, is_nullable: String, extra: String, table_name: String) -> Self { Self{ column_name, data_type, @@ -67,7 +67,7 @@ impl ColumnInfo { } } - fn new2(column_name: &str, data_type: &str, full_data_type: &str, character_maximum_length: Option, numeric_precision: u8, numeric_scale: u8, datetime_precision: Option, column_default: Option<&str>, is_nullable: &str, extra: &str, table_name: &str) -> Self { + fn new2(column_name: &str, data_type: &str, full_data_type: &str, character_maximum_length: Option, numeric_precision: Option, numeric_scale: Option, datetime_precision: Option, column_default: Option<&str>, is_nullable: &str, extra: &str, table_name: &str) -> Self { Self::new( column_name.to_string(), data_type.to_string(), @@ -252,7 +252,7 @@ async fn main() { //, vec![std::env::var("VT_DATABASE").unwrap()]).await let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, 10, 0, None, None, "NO", "", "a")); - assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, 10, 0, None, None, "NO", "", "a")); + assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); + assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); } From de06ae4086ae8c2deebc38c24f413cf7b6bf0559 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 21:06:52 -0500 Subject: [PATCH 07/16] frameworks/rust/mysql_async/src/src/main.rs: Add case for the query from Prisma, but in plaintext instead of prepared --- frameworks/rust/mysql_async/src/src/main.rs | 25 ++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 38695c86..050dd7d6 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -230,6 +230,29 @@ async fn main() { println!("--- query:{}", query); conn.query_drop(query).await.expect("CREATE TABLE `s` failed"); + let query = r" + SELECT + column_name column_name, + data_type data_type, + column_type full_data_type, + character_maximum_length character_maximum_length, + numeric_precision numeric_precision, + numeric_scale numeric_scale, + datetime_precision datetime_precision, + column_default column_default, + is_nullable is_nullable, + extra extra, + table_name table_name + FROM information_schema.columns + WHERE table_schema = '".to_owned() + &std::env::var("VT_DATABASE").unwrap() + r"' + ORDER BY ordinal_position + "; + println!("--- query:{}", query); + let rows: Vec = conn.query(query).await.expect("SELECT from information_schema.columns failed"); + assert_eq!(rows.len(), 2); + assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); + assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); + let query = r" SELECT column_name column_name, @@ -250,7 +273,7 @@ async fn main() { println!("--- query:{}", query); let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); //, vec![std::env::var("VT_DATABASE").unwrap()]).await - let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("SELECT from information_schema.columns failed"); + let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("exec prepared SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); From 2f02f0d191f48b92ca16f3268af785ca03eb4194 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 21:07:08 -0500 Subject: [PATCH 08/16] frameworks/rust/mysql_async/src/src/main.rs: rm no-longer-needed comment about args --- frameworks/rust/mysql_async/src/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 050dd7d6..adbd23bc 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -272,7 +272,6 @@ async fn main() { "; println!("--- query:{}", query); let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); - //, vec![std::env::var("VT_DATABASE").unwrap()]).await let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("exec prepared SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); From c97a4c0c28cfdfbaaa5fb6dc6c6c23a894ec45e0 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 21:09:30 -0500 Subject: [PATCH 09/16] frameworks/rust/mysql_async/src/src/main.rs: Support both MySQL 5.7 and MySQL 8.0 in Prisma test cases --- frameworks/rust/mysql_async/src/src/main.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index adbd23bc..9d5adbae 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -250,8 +250,14 @@ async fn main() { println!("--- query:{}", query); let rows: Vec = conn.query(query).await.expect("SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); - assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); + assert!( + rows[0] == ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[0] == ColumnInfo::new2("one", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); + assert!( + rows[1] == ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[1] == ColumnInfo::new2("two", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); let query = r" SELECT @@ -274,7 +280,13 @@ async fn main() { let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("exec prepared SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - assert_eq!(rows[0], ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); - assert_eq!(rows[1], ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a")); + assert!( + rows[0] == ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[0] == ColumnInfo::new2("one", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); + assert!( + rows[1] == ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[1] == ColumnInfo::new2("two", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); } From 77e719a5a9f561e2adcbb236b4223ff239e2815b Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Wed, 10 Mar 2021 21:10:13 -0500 Subject: [PATCH 10/16] src/main.rs: Add comment explaining OR in assert!() --- frameworks/rust/mysql_async/src/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 9d5adbae..c0f2e6b8 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -250,6 +250,7 @@ async fn main() { println!("--- query:{}", query); let rows: Vec = conn.query(query).await.expect("SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); + // MySQL 5.7 returns "int(11)" for column_type; 8.0 only returns "int" assert!( rows[0] == ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || rows[0] == ColumnInfo::new2("one", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") From 705ef0994d75ce18f5636a70f70e8077500eb523 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Thu, 25 Mar 2021 17:54:33 +0530 Subject: [PATCH 11/16] added assert for each column Signed-off-by: Harshit Gangal --- frameworks/rust/mysql_async/src/src/main.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index c0f2e6b8..ebf76313 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -281,13 +281,18 @@ async fn main() { let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("exec prepared SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - assert!( - rows[0] == ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || - rows[0] == ColumnInfo::new2("one", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") - ); - assert!( - rows[1] == ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || - rows[1] == ColumnInfo::new2("two", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") - ); + for row in rows { + assert!(row.column_name.eq("one") || row.column_name.eq("two")); + assert_eq!(row.data_type, "one"); + assert_eq!(row.full_data_type, "one"); + assert_eq!(row.character_maximum_length, None); + assert_eq!(row.numeric_precision, Some(10)); + assert_eq!(row.numeric_scale, Some(0)); + assert_eq!(row.datetime_precision, None); + assert_eq!(row.column_default, None); + assert_eq!(row.is_nullable, "NO"); + assert_eq!(row.extra, ""); + assert_eq!(row.table_name, "a"); + } } From 7fe56333824978175739fc66c07bb0b3a88a69bc Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Thu, 25 Mar 2021 18:12:23 +0530 Subject: [PATCH 12/16] fix assert Signed-off-by: Harshit Gangal --- frameworks/rust/mysql_async/src/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 06d7e864..8e24be71 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -283,8 +283,8 @@ async fn main() { assert_eq!(rows.len(), 2); for row in rows { assert!(row.column_name.eq("one") || row.column_name.eq("two")); - assert_eq!(row.data_type, "one"); - assert_eq!(row.full_data_type, "one"); + assert_eq!(row.data_type, "int"); + assert!(row.full_data_type.eq("int") || row.full_data_type.eq("int(11)")); assert_eq!(row.character_maximum_length, None); assert_eq!(row.numeric_precision, Some(10)); assert_eq!(row.numeric_scale, Some(0)); From 1f6e268d7ce5fe8c82df5332362bfdbfb851c296 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Thu, 25 Mar 2021 20:19:43 +0530 Subject: [PATCH 13/16] comment out utf8mb4 test Signed-off-by: Harshit Gangal --- frameworks/rust/mysql_async/src/src/main.rs | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 8e24be71..82a8024f 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -325,17 +325,17 @@ async fn main() { println!("--- query:\n\t{}\n\n", query); conn.query_drop(query).await.unwrap(); - let query = "INSERT INTO ScalarModel (id, optString, optInt, optFloat, optBoolean, optEnum, optDateTime) VALUES (?, ?, ?, ?, ?, ?, ?)"; - println!("--- query:\n\t{}", query); - let stmt = conn.prep(query).await.unwrap(); - conn.exec_drop(&stmt, ( - "ckmayvmxx0000roj6dynmo5uj", - "lalaยฅเธฟ๐Ÿ˜€๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜ˆ๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜“๐Ÿ˜”๐Ÿ˜•๐Ÿ˜–๐Ÿ˜—๐Ÿ˜˜๐Ÿ˜™๐Ÿ˜š๐Ÿ˜›๐Ÿ˜œ๐Ÿ˜๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฅ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜จ๐Ÿ˜ฉ๐Ÿ˜ช๐Ÿ˜ซ๐Ÿ˜ฌ๐Ÿ˜ญ๐Ÿ˜ฎ๐Ÿ˜ฏ๐Ÿ˜ฐ๐Ÿ˜ฑ๐Ÿ˜ฒ๐Ÿ˜ณ๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ถ๐Ÿ˜ท๐Ÿ˜ธ๐Ÿ˜น๐Ÿ˜บ๐Ÿ˜ป๐Ÿ˜ผ๐Ÿ˜ฝ๐Ÿ˜พ๐Ÿ˜ฟ๐Ÿ™€๐Ÿ™๐Ÿ™‚๐Ÿ™ƒ๐Ÿ™„๐Ÿ™…๐Ÿ™†๐Ÿ™‡๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ™‹๐Ÿ™Œ๐Ÿ™๐Ÿ™Ž๐Ÿ™เค€เคเค‚เคƒเค„เค…เค†เค‡เคˆเค‰เคŠเค‹เคŒเคเคŽเคเคเค‘เค’เค“เค”เค•เค–เค—เค˜เค™เคšเค›เคœเคเคžเคŸเค เคกเคขเคฃเคคเคฅเคฆเคงเคจเคฉเคชเคซเคฌเคญเคฎเคฏเคฐโ‚ฌโ‚ญโ‚ฎโ‚ฏโ‚ฐโ‚ฑโ‚ฒโ‚ณโ‚ดโ‚ตโ‚ถโ‚ทโ‚ธโ‚นโ‚บโ‚ปโ‚ผโ‚ฝโ‚พโ‚ฟโƒ€", - 1337, - 1.234, - true, - "A", - "2016-07-31 23:59:01" - )).await.unwrap(); + // let query = "INSERT INTO ScalarModel (id, optString, optInt, optFloat, optBoolean, optEnum, optDateTime) VALUES (?, ?, ?, ?, ?, ?, ?)"; + // println!("--- query:\n\t{}", query); + // let stmt = conn.prep(query).await.unwrap(); + // conn.exec_drop(&stmt, ( + // "ckmayvmxx0000roj6dynmo5uj", + // "lalaยฅเธฟ๐Ÿ˜€๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜ˆ๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜“๐Ÿ˜”๐Ÿ˜•๐Ÿ˜–๐Ÿ˜—๐Ÿ˜˜๐Ÿ˜™๐Ÿ˜š๐Ÿ˜›๐Ÿ˜œ๐Ÿ˜๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฅ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜จ๐Ÿ˜ฉ๐Ÿ˜ช๐Ÿ˜ซ๐Ÿ˜ฌ๐Ÿ˜ญ๐Ÿ˜ฎ๐Ÿ˜ฏ๐Ÿ˜ฐ๐Ÿ˜ฑ๐Ÿ˜ฒ๐Ÿ˜ณ๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ถ๐Ÿ˜ท๐Ÿ˜ธ๐Ÿ˜น๐Ÿ˜บ๐Ÿ˜ป๐Ÿ˜ผ๐Ÿ˜ฝ๐Ÿ˜พ๐Ÿ˜ฟ๐Ÿ™€๐Ÿ™๐Ÿ™‚๐Ÿ™ƒ๐Ÿ™„๐Ÿ™…๐Ÿ™†๐Ÿ™‡๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ™‹๐Ÿ™Œ๐Ÿ™๐Ÿ™Ž๐Ÿ™เค€เคเค‚เคƒเค„เค…เค†เค‡เคˆเค‰เคŠเค‹เคŒเคเคŽเคเคเค‘เค’เค“เค”เค•เค–เค—เค˜เค™เคšเค›เคœเคเคžเคŸเค เคกเคขเคฃเคคเคฅเคฆเคงเคจเคฉเคชเคซเคฌเคญเคฎเคฏเคฐโ‚ฌโ‚ญโ‚ฎโ‚ฏโ‚ฐโ‚ฑโ‚ฒโ‚ณโ‚ดโ‚ตโ‚ถโ‚ทโ‚ธโ‚นโ‚บโ‚ปโ‚ผโ‚ฝโ‚พโ‚ฟโƒ€", + // 1337, + // 1.234, + // true, + // "A", + // "2016-07-31 23:59:01" + // )).await.unwrap(); } From 4cc955a9687a023e4b7a6d30befa03d36a230100 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Fri, 26 Mar 2021 11:05:57 -0400 Subject: [PATCH 14/16] Revert "comment out utf8mb4 test" This reverts commit 1f6e268d7ce5fe8c82df5332362bfdbfb851c296. --- frameworks/rust/mysql_async/src/src/main.rs | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 82a8024f..8e24be71 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -325,17 +325,17 @@ async fn main() { println!("--- query:\n\t{}\n\n", query); conn.query_drop(query).await.unwrap(); - // let query = "INSERT INTO ScalarModel (id, optString, optInt, optFloat, optBoolean, optEnum, optDateTime) VALUES (?, ?, ?, ?, ?, ?, ?)"; - // println!("--- query:\n\t{}", query); - // let stmt = conn.prep(query).await.unwrap(); - // conn.exec_drop(&stmt, ( - // "ckmayvmxx0000roj6dynmo5uj", - // "lalaยฅเธฟ๐Ÿ˜€๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜ˆ๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜“๐Ÿ˜”๐Ÿ˜•๐Ÿ˜–๐Ÿ˜—๐Ÿ˜˜๐Ÿ˜™๐Ÿ˜š๐Ÿ˜›๐Ÿ˜œ๐Ÿ˜๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฅ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜จ๐Ÿ˜ฉ๐Ÿ˜ช๐Ÿ˜ซ๐Ÿ˜ฌ๐Ÿ˜ญ๐Ÿ˜ฎ๐Ÿ˜ฏ๐Ÿ˜ฐ๐Ÿ˜ฑ๐Ÿ˜ฒ๐Ÿ˜ณ๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ถ๐Ÿ˜ท๐Ÿ˜ธ๐Ÿ˜น๐Ÿ˜บ๐Ÿ˜ป๐Ÿ˜ผ๐Ÿ˜ฝ๐Ÿ˜พ๐Ÿ˜ฟ๐Ÿ™€๐Ÿ™๐Ÿ™‚๐Ÿ™ƒ๐Ÿ™„๐Ÿ™…๐Ÿ™†๐Ÿ™‡๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ™‹๐Ÿ™Œ๐Ÿ™๐Ÿ™Ž๐Ÿ™เค€เคเค‚เคƒเค„เค…เค†เค‡เคˆเค‰เคŠเค‹เคŒเคเคŽเคเคเค‘เค’เค“เค”เค•เค–เค—เค˜เค™เคšเค›เคœเคเคžเคŸเค เคกเคขเคฃเคคเคฅเคฆเคงเคจเคฉเคชเคซเคฌเคญเคฎเคฏเคฐโ‚ฌโ‚ญโ‚ฎโ‚ฏโ‚ฐโ‚ฑโ‚ฒโ‚ณโ‚ดโ‚ตโ‚ถโ‚ทโ‚ธโ‚นโ‚บโ‚ปโ‚ผโ‚ฝโ‚พโ‚ฟโƒ€", - // 1337, - // 1.234, - // true, - // "A", - // "2016-07-31 23:59:01" - // )).await.unwrap(); + let query = "INSERT INTO ScalarModel (id, optString, optInt, optFloat, optBoolean, optEnum, optDateTime) VALUES (?, ?, ?, ?, ?, ?, ?)"; + println!("--- query:\n\t{}", query); + let stmt = conn.prep(query).await.unwrap(); + conn.exec_drop(&stmt, ( + "ckmayvmxx0000roj6dynmo5uj", + "lalaยฅเธฟ๐Ÿ˜€๐Ÿ˜๐Ÿ˜‚๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ˜…๐Ÿ˜†๐Ÿ˜‡๐Ÿ˜ˆ๐Ÿ˜‰๐Ÿ˜Š๐Ÿ˜‹๐Ÿ˜Œ๐Ÿ˜๐Ÿ˜Ž๐Ÿ˜๐Ÿ˜๐Ÿ˜‘๐Ÿ˜’๐Ÿ˜“๐Ÿ˜”๐Ÿ˜•๐Ÿ˜–๐Ÿ˜—๐Ÿ˜˜๐Ÿ˜™๐Ÿ˜š๐Ÿ˜›๐Ÿ˜œ๐Ÿ˜๐Ÿ˜ž๐Ÿ˜Ÿ๐Ÿ˜ ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜ฃ๐Ÿ˜ค๐Ÿ˜ฅ๐Ÿ˜ฆ๐Ÿ˜ง๐Ÿ˜จ๐Ÿ˜ฉ๐Ÿ˜ช๐Ÿ˜ซ๐Ÿ˜ฌ๐Ÿ˜ญ๐Ÿ˜ฎ๐Ÿ˜ฏ๐Ÿ˜ฐ๐Ÿ˜ฑ๐Ÿ˜ฒ๐Ÿ˜ณ๐Ÿ˜ด๐Ÿ˜ต๐Ÿ˜ถ๐Ÿ˜ท๐Ÿ˜ธ๐Ÿ˜น๐Ÿ˜บ๐Ÿ˜ป๐Ÿ˜ผ๐Ÿ˜ฝ๐Ÿ˜พ๐Ÿ˜ฟ๐Ÿ™€๐Ÿ™๐Ÿ™‚๐Ÿ™ƒ๐Ÿ™„๐Ÿ™…๐Ÿ™†๐Ÿ™‡๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š๐Ÿ™‹๐Ÿ™Œ๐Ÿ™๐Ÿ™Ž๐Ÿ™เค€เคเค‚เคƒเค„เค…เค†เค‡เคˆเค‰เคŠเค‹เคŒเคเคŽเคเคเค‘เค’เค“เค”เค•เค–เค—เค˜เค™เคšเค›เคœเคเคžเคŸเค เคกเคขเคฃเคคเคฅเคฆเคงเคจเคฉเคชเคซเคฌเคญเคฎเคฏเคฐโ‚ฌโ‚ญโ‚ฎโ‚ฏโ‚ฐโ‚ฑโ‚ฒโ‚ณโ‚ดโ‚ตโ‚ถโ‚ทโ‚ธโ‚นโ‚บโ‚ปโ‚ผโ‚ฝโ‚พโ‚ฟโƒ€", + 1337, + 1.234, + true, + "A", + "2016-07-31 23:59:01" + )).await.unwrap(); } From e37193b1f8dd44c7139904e2ce3a63148ec2aa80 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Fri, 26 Mar 2021 11:06:09 -0400 Subject: [PATCH 15/16] Revert "fix assert" This reverts commit 7fe56333824978175739fc66c07bb0b3a88a69bc. --- frameworks/rust/mysql_async/src/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 8e24be71..06d7e864 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -283,8 +283,8 @@ async fn main() { assert_eq!(rows.len(), 2); for row in rows { assert!(row.column_name.eq("one") || row.column_name.eq("two")); - assert_eq!(row.data_type, "int"); - assert!(row.full_data_type.eq("int") || row.full_data_type.eq("int(11)")); + assert_eq!(row.data_type, "one"); + assert_eq!(row.full_data_type, "one"); assert_eq!(row.character_maximum_length, None); assert_eq!(row.numeric_precision, Some(10)); assert_eq!(row.numeric_scale, Some(0)); From 55d2e6c2d07f51c865a76eb28a42e7687e2ef5d4 Mon Sep 17 00:00:00 2001 From: Mike Cronce Date: Fri, 26 Mar 2021 11:10:20 -0400 Subject: [PATCH 16/16] Revert "added assert for each column" This reverts commit 705ef0994d75ce18f5636a70f70e8077500eb523. --- frameworks/rust/mysql_async/src/src/main.rs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/frameworks/rust/mysql_async/src/src/main.rs b/frameworks/rust/mysql_async/src/src/main.rs index 06d7e864..cb556669 100644 --- a/frameworks/rust/mysql_async/src/src/main.rs +++ b/frameworks/rust/mysql_async/src/src/main.rs @@ -281,19 +281,14 @@ async fn main() { let stmt = conn.prep(query).await.expect("prepare SELECT from information_schema.columns failed"); let rows: Vec = conn.exec(stmt, (std::env::var("VT_DATABASE").unwrap(),)).await.expect("exec prepared SELECT from information_schema.columns failed"); assert_eq!(rows.len(), 2); - for row in rows { - assert!(row.column_name.eq("one") || row.column_name.eq("two")); - assert_eq!(row.data_type, "one"); - assert_eq!(row.full_data_type, "one"); - assert_eq!(row.character_maximum_length, None); - assert_eq!(row.numeric_precision, Some(10)); - assert_eq!(row.numeric_scale, Some(0)); - assert_eq!(row.datetime_precision, None); - assert_eq!(row.column_default, None); - assert_eq!(row.is_nullable, "NO"); - assert_eq!(row.extra, ""); - assert_eq!(row.table_name, "a"); - } + assert!( + rows[0] == ColumnInfo::new2("one", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[0] == ColumnInfo::new2("one", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); + assert!( + rows[1] == ColumnInfo::new2("two", "int", "int(11)", None, Some(10), Some(0), None, None, "NO", "", "a") || + rows[1] == ColumnInfo::new2("two", "int", "int", None, Some(10), Some(0), None, None, "NO", "", "a") + ); let query = r" CREATE TABLE `ScalarModel` (