mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 06:18:17 +00:00
Support SQLite CREATE VIRTUAL TABLE
(#209)
`CREATE VIRTUAL TABLE .. USING <module_name> (<module_args>)` https://www.sqlite.org/lang_createvtab.html
This commit is contained in:
parent
0c83e5d9e8
commit
a53f1d26ef
5 changed files with 73 additions and 4 deletions
|
@ -33,6 +33,28 @@ fn parse_create_table_without_rowid() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_create_virtual_table() {
|
||||
let sql = "CREATE VIRTUAL TABLE IF NOT EXISTS t USING module_name (arg1, arg2)";
|
||||
match sqlite_and_generic().verified_stmt(sql) {
|
||||
Statement::CreateVirtualTable {
|
||||
name,
|
||||
if_not_exists: true,
|
||||
module_name,
|
||||
module_args,
|
||||
} => {
|
||||
let args = vec![Ident::new("arg1"), Ident::new("arg2")];
|
||||
assert_eq!("t", name.to_string());
|
||||
assert_eq!("module_name", module_name.to_string());
|
||||
assert_eq!(args, module_args);
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let sql = "CREATE VIRTUAL TABLE t USING module_name";
|
||||
sqlite_and_generic().verified_stmt(sql);
|
||||
}
|
||||
|
||||
fn sqlite_and_generic() -> TestedDialects {
|
||||
TestedDialects {
|
||||
// we don't have a separate SQLite dialect, so test only the generic dialect for now
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue