Skip to content

Commit

Permalink
Blocking Issues: upgrade to SQLx 0.8 on hold, just testing a workarou…
Browse files Browse the repository at this point in the history
…nd, not an ideal fix (launchbadge/sqlx#3387)
  • Loading branch information
billy1624 committed Aug 2, 2024
1 parent 1147bc9 commit a709e34
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
14 changes: 9 additions & 5 deletions src/mysql/query/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<u8>, _>(1)).unwrap(),
is_nullable: row.get(2),
column_key: row.get(3),
column_default: row.get(4),
column_key: String::from_utf8(row.get::<Vec<u8>, _>(3)).unwrap(),
column_default: row
.get::<Option<Vec<u8>>, _>(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::<Option<Vec<u8>>, _>(6)
.map(|v| String::from_utf8(v).unwrap()),
column_comment: String::from_utf8(row.get::<Vec<u8>, _>(7)).unwrap(),
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/mysql/query/foreign_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<u8>, _>(2)).unwrap(),
referenced_column_name: String::from_utf8(row.get::<Vec<u8>, _>(3)).unwrap(),
update_rule: String::from_utf8(row.get::<Vec<u8>, _>(4)).unwrap(),
delete_rule: String::from_utf8(row.get::<Vec<u8>, _>(5)).unwrap(),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mysql/query/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<u8>, _>(6)).unwrap(),
index_comment: String::from_utf8(row.get::<Vec<u8>, _>(7)).unwrap(),
expression: row.get(8),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mysql/query/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<u8>, _>(0)).unwrap(),
engine: row.get(1),
auto_increment: row.get(2),
table_collation: row.get(3),
Expand Down

0 comments on commit a709e34

Please sign in to comment.