Skip to content

Commit

Permalink
Upgrade sea-query to 0.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Jul 1, 2022
1 parent e92631c commit 2e42cf7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ path = "src/lib.rs"
[dependencies]
futures = { version = "0.3", optional = true }
sea-schema-derive = { version = "0.1.0", path = "sea-schema-derive" }
sea-query = { version = "^0.25.0" }
sea-query = { version = "^0.26.0" }
serde = { version = "^1", features = ["derive"], optional = true }
sqlx = { version = "^0.5", optional = true }
sqlx = { version = "^0.6", optional = true }
log = { version = "^0.4", optional = true }

[features]
Expand Down
6 changes: 3 additions & 3 deletions src/mysql/parser/column.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::mysql::def::*;
use crate::mysql::query::ColumnQueryResult;
use crate::{parser::Parser, Name};
use sea_query::unescape_string;
use sea_query::{EscapeBuilder, MysqlQueryBuilder};

impl ColumnQueryResult {
pub fn parse(self) -> ColumnInfo {
Expand Down Expand Up @@ -195,7 +195,7 @@ fn parse_enum_definition(parser: &mut Parser, mut ctype: ColumnType) -> ColumnTy
ctype
.get_enum_def_mut()
.values
.push(unescape_string(word.unquote().unwrap().as_str()));
.push(MysqlQueryBuilder.unescape_string(word.unquote().unwrap().as_str()));
parser.next_if_punctuation(",");
} else if parser.curr_is_unquoted() {
todo!("there can actually be numeric enum values but is very confusing");
Expand All @@ -218,7 +218,7 @@ fn parse_set_definition(parser: &mut Parser, mut ctype: ColumnType) -> ColumnTyp
ctype
.get_set_def_mut()
.members
.push(unescape_string(word.unquote().unwrap().as_str()));
.push(MysqlQueryBuilder.unescape_string(word.unquote().unwrap().as_str()));
parser.next_if_punctuation(",");
} else if parser.curr_is_unquoted() {
todo!("there can actually be numeric set values but is very confusing");
Expand Down
9 changes: 7 additions & 2 deletions src/mysql/writer/column.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::mysql::def::{CharSet, ColumnInfo, NumericAttr, StringAttr, Type};
use sea_query::{escape_string, Alias, BlobSize, ColumnDef, Iden};
use sea_query::{Alias, BlobSize, ColumnDef, EscapeBuilder, Iden, MysqlQueryBuilder};
use std::fmt::Write;

impl ColumnInfo {
Expand All @@ -23,7 +23,12 @@ impl ColumnInfo {
}
if !self.comment.is_empty() {
let mut string = "".to_owned();
write!(&mut string, "COMMENT '{}'", escape_string(&self.comment)).unwrap();
write!(
&mut string,
"COMMENT '{}'",
MysqlQueryBuilder.escape_string(&self.comment)
)
.unwrap();
extras.push(string);
}
if !extras.is_empty() {
Expand Down
6 changes: 3 additions & 3 deletions src/mysql/writer/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::mysql::def::{
BlobAttr, EnumDef, GeometryAttr, NumericAttr, SetDef, StringAttr, TimeAttr, Type,
};
use sea_query::{escape_string, Iden};
use sea_query::{EscapeBuilder, Iden, MysqlQueryBuilder};

impl Iden for Type {
fn unquoted(&self, s: &mut dyn std::fmt::Write) {
Expand Down Expand Up @@ -226,7 +226,7 @@ impl Type {
if i > 0 {
write!(s, ", ").unwrap();
}
write!(s, "\'{}\'", escape_string(val.as_str())).unwrap();
write!(s, "\'{}\'", MysqlQueryBuilder.escape_string(val.as_str())).unwrap();
}
write!(s, ")").unwrap();
Self::write_string_attr(s, &def.attr);
Expand All @@ -238,7 +238,7 @@ impl Type {
if i > 0 {
write!(s, ", ").unwrap();
}
write!(s, "\'{}\'", escape_string(val.as_str())).unwrap();
write!(s, "\'{}\'", MysqlQueryBuilder.escape_string(val.as_str())).unwrap();
}
write!(s, ")").unwrap();
Self::write_string_attr(s, &def.attr);
Expand Down

0 comments on commit 2e42cf7

Please sign in to comment.