mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 15:04:04 +00:00
Support parsing multiple show variables. (#290)
* feat: support parsing multiple show variables. * fix: fix fmt error
This commit is contained in:
parent
f40955ee82
commit
07342d5853
3 changed files with 26 additions and 7 deletions
|
@ -2043,6 +2043,19 @@ impl<'a> Parser<'a> {
|
|||
Ok(ObjectName(idents))
|
||||
}
|
||||
|
||||
/// Parse identifiers
|
||||
pub fn parse_identifiers(&mut self) -> Result<Vec<Ident>, ParserError> {
|
||||
let mut idents = vec![];
|
||||
loop {
|
||||
match self.next_token() {
|
||||
Token::Word(w) => idents.push(w.to_ident()),
|
||||
Token::EOF => break,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
Ok(idents)
|
||||
}
|
||||
|
||||
/// Parse a simple one-word identifier (possibly quoted, possibly a keyword)
|
||||
pub fn parse_identifier(&mut self) -> Result<Ident, ParserError> {
|
||||
match self.next_token() {
|
||||
|
@ -2439,7 +2452,7 @@ impl<'a> Parser<'a> {
|
|||
self.parse_show_columns()
|
||||
} else {
|
||||
Ok(Statement::ShowVariable {
|
||||
variable: self.parse_identifier()?,
|
||||
variable: self.parse_identifiers()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue