mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-15 08:19:08 +00:00
Add support for DEFERRED, IMMEDIATE, and EXCLUSIVE in SQLite's BEGIN TRANSACTION command (#1067)
This commit is contained in:
parent
40bc407799
commit
1baec96685
7 changed files with 94 additions and 2 deletions
|
@ -7961,14 +7961,27 @@ impl<'a> Parser<'a> {
|
|||
Ok(Statement::StartTransaction {
|
||||
modes: self.parse_transaction_modes()?,
|
||||
begin: false,
|
||||
modifier: None,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn parse_begin(&mut self) -> Result<Statement, ParserError> {
|
||||
let modifier = if !self.dialect.supports_start_transaction_modifier() {
|
||||
None
|
||||
} else if self.parse_keyword(Keyword::DEFERRED) {
|
||||
Some(TransactionModifier::Deferred)
|
||||
} else if self.parse_keyword(Keyword::IMMEDIATE) {
|
||||
Some(TransactionModifier::Immediate)
|
||||
} else if self.parse_keyword(Keyword::EXCLUSIVE) {
|
||||
Some(TransactionModifier::Exclusive)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let _ = self.parse_one_of_keywords(&[Keyword::TRANSACTION, Keyword::WORK]);
|
||||
Ok(Statement::StartTransaction {
|
||||
modes: self.parse_transaction_modes()?,
|
||||
begin: true,
|
||||
modifier,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue