From a709e34836170622b8964d2ab9bdb7c0e310383d Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 2 Aug 2024 12:46:25 +0800 Subject: [PATCH] Blocking Issues: upgrade to SQLx 0.8 on hold, just testing a workaround, not an ideal fix (launchbadge/sqlx#3387) --- src/mysql/query/column.rs | 14 +++++++++----- src/mysql/query/foreign_key.rs | 8 ++++---- src/mysql/query/index.rs | 4 ++-- src/mysql/query/table.rs | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/mysql/query/column.rs b/src/mysql/query/column.rs index 439204b6..973fcf42 100644 --- a/src/mysql/query/column.rs +++ b/src/mysql/query/column.rs @@ -80,13 +80,17 @@ impl From<&MySqlRow> for ColumnQueryResult { use crate::sqlx_types::Row; Self { column_name: row.get(0), - column_type: row.get(1), + column_type: String::from_utf8(row.get::, _>(1)).unwrap(), is_nullable: row.get(2), - column_key: row.get(3), - column_default: row.get(4), + column_key: String::from_utf8(row.get::, _>(3)).unwrap(), + column_default: row + .get::>, _>(4) + .map(|v| String::from_utf8(v).unwrap()), extra: row.get(5), - generation_expression: row.get(6), - column_comment: row.get(7), + generation_expression: row + .get::>, _>(6) + .map(|v| String::from_utf8(v).unwrap()), + column_comment: String::from_utf8(row.get::, _>(7)).unwrap(), } } } diff --git a/src/mysql/query/foreign_key.rs b/src/mysql/query/foreign_key.rs index 8896a43b..ad34b15b 100644 --- a/src/mysql/query/foreign_key.rs +++ b/src/mysql/query/foreign_key.rs @@ -89,10 +89,10 @@ impl From<&MySqlRow> for ForeignKeyQueryResult { Self { constraint_name: row.get(0), column_name: row.get(1), - referenced_table_name: row.get(2), - referenced_column_name: row.get(3), - update_rule: row.get(4), - delete_rule: row.get(5), + referenced_table_name: String::from_utf8(row.get::, _>(2)).unwrap(), + referenced_column_name: String::from_utf8(row.get::, _>(3)).unwrap(), + update_rule: String::from_utf8(row.get::, _>(4)).unwrap(), + delete_rule: String::from_utf8(row.get::, _>(5)).unwrap(), } } } diff --git a/src/mysql/query/index.rs b/src/mysql/query/index.rs index 2aa2c8a1..031fd651 100644 --- a/src/mysql/query/index.rs +++ b/src/mysql/query/index.rs @@ -84,8 +84,8 @@ impl From<&MySqlRow> for IndexQueryResult { collation: row.get(3), sub_part: row.get(4), nullable: row.get(5), - index_type: row.get(6), - index_comment: row.get(7), + index_type: String::from_utf8(row.get::, _>(6)).unwrap(), + index_comment: String::from_utf8(row.get::, _>(7)).unwrap(), expression: row.get(8), } } diff --git a/src/mysql/query/table.rs b/src/mysql/query/table.rs index bef4b3e1..9123a41b 100644 --- a/src/mysql/query/table.rs +++ b/src/mysql/query/table.rs @@ -91,7 +91,7 @@ impl From<&MySqlRow> for TableQueryResult { fn from(row: &MySqlRow) -> Self { use crate::sqlx_types::Row; Self { - table_name: row.get(0), + table_name: String::from_utf8(row.get::, _>(0)).unwrap(), engine: row.get(1), auto_increment: row.get(2), table_collation: row.get(3),