Support USE db (#565)

This commit is contained in:
Alex Qyoun-ae 2022-08-11 14:49:20 +04:00 committed by GitHub
parent 71c3ec057b
commit a9db6ed139
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View file

@ -177,6 +177,7 @@ impl<'a> Parser<'a> {
Keyword::CLOSE => Ok(self.parse_close()?),
Keyword::SET => Ok(self.parse_set()?),
Keyword::SHOW => Ok(self.parse_show()?),
Keyword::USE => Ok(self.parse_use()?),
Keyword::GRANT => Ok(self.parse_grant()?),
Keyword::REVOKE => Ok(self.parse_revoke()?),
Keyword::START => Ok(self.parse_start_transaction()?),
@ -3776,6 +3777,11 @@ impl<'a> Parser<'a> {
}
}
pub fn parse_use(&mut self) -> Result<Statement, ParserError> {
let db_name = self.parse_identifier()?;
Ok(Statement::Use { db_name })
}
pub fn parse_table_and_joins(&mut self) -> Result<TableWithJoins, ParserError> {
let relation = self.parse_table_factor()?;
// Note that for keywords to be properly handled here, they need to be