mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-07 04:30:24 +00:00
Improve MySQL CREATE TRIGGER
parsing (#1998)
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
Some checks are pending
license / Release Audit Tool (RAT) (push) Waiting to run
Rust / codestyle (push) Waiting to run
Rust / lint (push) Waiting to run
Rust / benchmark-lint (push) Waiting to run
Rust / compile (push) Waiting to run
Rust / docs (push) Waiting to run
Rust / compile-no-std (push) Waiting to run
Rust / test (beta) (push) Waiting to run
Rust / test (nightly) (push) Waiting to run
Rust / test (stable) (push) Waiting to run
This commit is contained in:
parent
698154d0e0
commit
183bc7c5ff
7 changed files with 62 additions and 19 deletions
|
@ -5593,9 +5593,13 @@ impl<'a> Parser<'a> {
|
|||
.then(|| self.parse_expr())
|
||||
.transpose()?;
|
||||
|
||||
self.expect_keyword_is(Keyword::EXECUTE)?;
|
||||
|
||||
let exec_body = self.parse_trigger_exec_body()?;
|
||||
let mut exec_body = None;
|
||||
let mut statements = None;
|
||||
if self.parse_keyword(Keyword::EXECUTE) {
|
||||
exec_body = Some(self.parse_trigger_exec_body()?);
|
||||
} else {
|
||||
statements = Some(self.parse_conditional_statements(&[Keyword::END])?);
|
||||
}
|
||||
|
||||
Ok(Statement::CreateTrigger {
|
||||
or_alter,
|
||||
|
@ -5603,6 +5607,7 @@ impl<'a> Parser<'a> {
|
|||
is_constraint,
|
||||
name,
|
||||
period,
|
||||
period_before_table: true,
|
||||
events,
|
||||
table_name,
|
||||
referenced_table_name,
|
||||
|
@ -5610,8 +5615,9 @@ impl<'a> Parser<'a> {
|
|||
trigger_object,
|
||||
include_each,
|
||||
condition,
|
||||
exec_body: Some(exec_body),
|
||||
statements: None,
|
||||
exec_body,
|
||||
statements_as: false,
|
||||
statements,
|
||||
characteristics,
|
||||
})
|
||||
}
|
||||
|
@ -6537,7 +6543,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
let args = if self.consume_token(&Token::LParen) {
|
||||
if self.consume_token(&Token::RParen) {
|
||||
None
|
||||
Some(vec![])
|
||||
} else {
|
||||
let args = self.parse_comma_separated(Parser::parse_function_arg)?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
|
@ -9307,10 +9313,10 @@ impl<'a> Parser<'a> {
|
|||
}),
|
||||
}))
|
||||
} else {
|
||||
return self.expected_ref(
|
||||
self.expected_ref(
|
||||
"{RENAME TO | { RENAME | ADD } VALUE}",
|
||||
self.peek_token_ref(),
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue