Allow string values in pragma commands (#1101)

Co-authored-by: Michael Ionov <michael@appdome.com>
This commit is contained in:
Michael Ionov 2024-01-18 22:22:35 +02:00 committed by GitHub
parent 3ec337ec5f
commit b0b62887a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 63 additions and 2 deletions

View file

@ -70,6 +70,54 @@ fn pragma_funciton_style() {
}
}
#[test]
fn pragma_eq_string_style() {
let sql = "PRAGMA table_info = 'sqlite_master'";
match sqlite_and_generic().verified_stmt(sql) {
Statement::Pragma {
name,
value: Some(val),
is_eq: true,
} => {
assert_eq!("table_info", name.to_string());
assert_eq!("'sqlite_master'", val.to_string());
}
_ => unreachable!(),
}
}
#[test]
fn pragma_function_string_style() {
let sql = "PRAGMA table_info(\"sqlite_master\")";
match sqlite_and_generic().verified_stmt(sql) {
Statement::Pragma {
name,
value: Some(val),
is_eq: false,
} => {
assert_eq!("table_info", name.to_string());
assert_eq!("\"sqlite_master\"", val.to_string());
}
_ => unreachable!(),
}
}
#[test]
fn pragma_eq_placehoder_style() {
let sql = "PRAGMA table_info = ?";
match sqlite_and_generic().verified_stmt(sql) {
Statement::Pragma {
name,
value: Some(val),
is_eq: true,
} => {
assert_eq!("table_info", name.to_string());
assert_eq!("?", val.to_string());
}
_ => unreachable!(),
}
}
#[test]
fn parse_create_table_without_rowid() {
let sql = "CREATE TABLE t (a INT) WITHOUT ROWID";