mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-04 06:18:17 +00:00
support for session transaction and transaction snapshot. (#379)
* add support for snapshot id in set transaction Signed-off-by: poonai <rbalajis25@gmail.com> * add support for default session transaction characteristics Signed-off-by: poonai <rbalajis25@gmail.com> * add additional assertion for parse_set_transaction test Signed-off-by: poonai <rbalajis25@gmail.com> * Fix clippy Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
a81805ea30
commit
4c121a92a6
5 changed files with 78 additions and 11 deletions
|
@ -723,6 +723,32 @@ fn parse_map_access_expr() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_transaction_statement() {
|
||||
let statement = pg().verified_stmt("SET TRANSACTION SNAPSHOT '000003A1-1'");
|
||||
assert_eq!(
|
||||
statement,
|
||||
Statement::SetTransaction {
|
||||
modes: vec![],
|
||||
snapshot: Some(Value::SingleQuotedString(String::from("000003A1-1"))),
|
||||
session: false
|
||||
}
|
||||
);
|
||||
let statement = pg().verified_stmt("SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY, READ WRITE, ISOLATION LEVEL SERIALIZABLE");
|
||||
assert_eq!(
|
||||
statement,
|
||||
Statement::SetTransaction {
|
||||
modes: vec![
|
||||
TransactionMode::AccessMode(TransactionAccessMode::ReadOnly),
|
||||
TransactionMode::AccessMode(TransactionAccessMode::ReadWrite),
|
||||
TransactionMode::IsolationLevel(TransactionIsolationLevel::Serializable),
|
||||
],
|
||||
snapshot: None,
|
||||
session: true
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
fn pg() -> TestedDialects {
|
||||
TestedDialects {
|
||||
dialects: vec![Box::new(PostgreSqlDialect {})],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue