mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
Add support for ATTACH DATABASE (#989)
This commit is contained in:
parent
7723ea56c5
commit
495d0a02d5
4 changed files with 50 additions and 0 deletions
|
@ -259,6 +259,24 @@ fn parse_create_table_with_strict() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_attach_database() {
|
||||
let sql = "ATTACH DATABASE 'test.db' AS test";
|
||||
let verified_stmt = sqlite().verified_stmt(sql);
|
||||
assert_eq!(sql, format!("{}", verified_stmt));
|
||||
match verified_stmt {
|
||||
Statement::AttachDatabase {
|
||||
schema_name,
|
||||
database_file_name: Expr::Value(Value::SingleQuotedString(literal_name)),
|
||||
database: true,
|
||||
} => {
|
||||
assert_eq!(schema_name.value, "test");
|
||||
assert_eq!(literal_name, "test.db");
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn sqlite() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(SQLiteDialect {})],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue