mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-27 17:34:05 +00:00
Support optional semicolon between statements (#1937)
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
Some checks failed
license / Release Audit Tool (RAT) (push) Has been cancelled
Rust / codestyle (push) Has been cancelled
Rust / lint (push) Has been cancelled
Rust / benchmark-lint (push) Has been cancelled
Rust / compile (push) Has been cancelled
Rust / docs (push) Has been cancelled
Rust / compile-no-std (push) Has been cancelled
Rust / test (beta) (push) Has been cancelled
Rust / test (nightly) (push) Has been cancelled
Rust / test (stable) (push) Has been cancelled
This commit is contained in:
parent
ee31b64f9e
commit
bc2c4e263d
5 changed files with 59 additions and 3 deletions
|
@ -40,8 +40,9 @@ use sqlparser::parser::{Parser, ParserError, ParserOptions};
|
|||
use sqlparser::tokenizer::Tokenizer;
|
||||
use sqlparser::tokenizer::{Location, Span};
|
||||
use test_utils::{
|
||||
all_dialects, all_dialects_where, alter_table_op, assert_eq_vec, call, expr_from_projection,
|
||||
join, number, only, table, table_alias, table_from_name, TestedDialects,
|
||||
all_dialects, all_dialects_where, all_dialects_with_options, alter_table_op, assert_eq_vec,
|
||||
call, expr_from_projection, join, number, only, table, table_alias, table_from_name,
|
||||
TestedDialects,
|
||||
};
|
||||
|
||||
#[macro_use]
|
||||
|
@ -16115,3 +16116,20 @@ fn test_select_exclude() {
|
|||
ParserError::ParserError("Expected: end of statement, found: EXCLUDE".to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_no_semicolon_required_between_statements() {
|
||||
let sql = r#"
|
||||
SELECT * FROM tbl1
|
||||
SELECT * FROM tbl2
|
||||
"#;
|
||||
|
||||
let dialects = all_dialects_with_options(ParserOptions {
|
||||
trailing_commas: false,
|
||||
unescape: true,
|
||||
require_semicolon_stmt_delimiter: false,
|
||||
});
|
||||
let stmts = dialects.parse_sql_statements(sql).unwrap();
|
||||
assert_eq!(stmts.len(), 2);
|
||||
assert!(stmts.iter().all(|s| matches!(s, Statement::Query { .. })));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue