Skip to content

Commit

Permalink
alignment logic
Browse files Browse the repository at this point in the history
Signed-off-by: zjregee <[email protected]>
  • Loading branch information
zjregee committed Sep 1, 2024
1 parent f482704 commit 3c08e98
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions sqllogictest-engines/src/mysql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::process::Command;
use std::time::Duration;

use async_trait::async_trait;
use mysql_async::prelude::*;
use mysql_async::prelude::FromValue;
use mysql_async::prelude::Queryable;
use mysql_async::FromValueError;
use sqllogictest::{DBOutput, DefaultColumnType};

type Result<T> = std::result::Result<T, mysql_async::Error>;
Expand Down Expand Up @@ -36,8 +38,20 @@ impl sqllogictest::AsyncDB for MySql {
for row in rows {
let mut row_vec = vec![];
for i in 0..row.len() {
let value: String = FromValue::from_value(row[i].clone());
row_vec.push(value);
let value: std::result::Result<String, FromValueError> =
FromValue::from_value_opt(row[i].clone());
match value {
Ok(value) => {
if value.is_empty() {
row_vec.push("(empty)".to_string());
} else {
row_vec.push(value);
}
}
Err(_) => {
row_vec.push("NULL".to_string());
}
}
}
output.push(row_vec);
}
Expand Down

0 comments on commit 3c08e98

Please sign in to comment.