fix(macros): reintroduce and fix macro tests for MySQL

This commit is contained in:
Austin Bonander
2020-06-05 21:02:24 -07:00
parent bddb2e560f
commit 80b4e2fca6
7 changed files with 121 additions and 2 deletions

View File

@@ -275,9 +275,10 @@ impl<'c> Executor<'c> for &'c mut MySqlConnection {
for _ in 0..(ok.columns as usize) {
let def: ColumnDefinition = self.stream.recv().await?;
let ty = MySqlTypeInfo::from_column(&def);
let name = def.name()?;
columns.push(Column {
name: def.name()?.to_owned(),
name: if name.is_empty() { def.alias()? } else { name }.to_owned(),
type_info: ty,
not_null: Some(def.flags.contains(ColumnFlags::NOT_NULL)),
})

View File

@@ -78,6 +78,18 @@ impl PartialEq<MySqlTypeInfo> for MySqlTypeInfo {
== other.flags.contains(ColumnFlags::UNSIGNED);
}
// for string types, check that our charset matches
ColumnType::VarChar
| ColumnType::Blob
| ColumnType::TinyBlob
| ColumnType::MediumBlob
| ColumnType::LongBlob
| ColumnType::String
| ColumnType::VarString
| ColumnType::Enum => {
return self.char_set == other.char_set;
}
_ => {}
}

View File

@@ -36,7 +36,7 @@ impl<'r> Decode<'r, MySql> for &'r str {
| ColumnType::String
| ColumnType::VarString
| ColumnType::Enum
)
) && ty.char_set == 224
}
fn decode(value: MySqlValueRef<'r>) -> Result<Self, BoxDynError> {