mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-30 18:57:21 +00:00
feat: Support CLOSE (cursors) (#515)
This commit is contained in:
parent
3f1c6426f0
commit
d361c3a3a1
3 changed files with 61 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
#[macro_use]
|
||||
mod test_utils;
|
||||
|
||||
use matches::assert_matches;
|
||||
use sqlparser::ast::*;
|
||||
use sqlparser::dialect::{
|
||||
|
@ -28,6 +29,7 @@ use sqlparser::dialect::{
|
|||
};
|
||||
use sqlparser::keywords::ALL_KEYWORDS;
|
||||
use sqlparser::parser::{Parser, ParserError};
|
||||
|
||||
use test_utils::{
|
||||
all_dialects, expr_from_projection, join, number, only, table, table_alias, TestedDialects,
|
||||
};
|
||||
|
@ -4944,3 +4946,23 @@ fn parse_discard() {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_cursor() {
|
||||
let sql = r#"CLOSE my_cursor"#;
|
||||
match verified_stmt(sql) {
|
||||
Statement::Close { cursor } => assert_eq!(
|
||||
cursor,
|
||||
CloseCursor::Specific {
|
||||
name: Ident::new("my_cursor"),
|
||||
}
|
||||
),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let sql = r#"CLOSE ALL"#;
|
||||
match verified_stmt(sql) {
|
||||
Statement::Close { cursor } => assert_eq!(cursor, CloseCursor::All),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue