mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 13:40:15 +00:00
Add support for mysql 'SHOW CREATE VIEW' statement (#536)
This commit is contained in:
parent
dea7666086
commit
93e16e9864
3 changed files with 5 additions and 0 deletions
|
@ -705,6 +705,7 @@ pub enum ShowCreateObject {
|
|||
Procedure,
|
||||
Table,
|
||||
Trigger,
|
||||
View,
|
||||
}
|
||||
|
||||
impl fmt::Display for ShowCreateObject {
|
||||
|
@ -715,6 +716,7 @@ impl fmt::Display for ShowCreateObject {
|
|||
ShowCreateObject::Procedure => f.write_str("PROCEDURE"),
|
||||
ShowCreateObject::Table => f.write_str("TABLE"),
|
||||
ShowCreateObject::Trigger => f.write_str("TRIGGER"),
|
||||
ShowCreateObject::View => f.write_str("VIEW"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3610,12 +3610,14 @@ impl<'a> Parser<'a> {
|
|||
Keyword::FUNCTION,
|
||||
Keyword::PROCEDURE,
|
||||
Keyword::EVENT,
|
||||
Keyword::VIEW,
|
||||
])? {
|
||||
Keyword::TABLE => Ok(ShowCreateObject::Table),
|
||||
Keyword::TRIGGER => Ok(ShowCreateObject::Trigger),
|
||||
Keyword::FUNCTION => Ok(ShowCreateObject::Function),
|
||||
Keyword::PROCEDURE => Ok(ShowCreateObject::Procedure),
|
||||
Keyword::EVENT => Ok(ShowCreateObject::Event),
|
||||
Keyword::VIEW => Ok(ShowCreateObject::View),
|
||||
keyword => Err(ParserError::ParserError(format!(
|
||||
"Unable to map keyword to ShowCreateObject: {:?}",
|
||||
keyword
|
||||
|
|
|
@ -128,6 +128,7 @@ fn parse_show_create() {
|
|||
ShowCreateObject::Event,
|
||||
ShowCreateObject::Function,
|
||||
ShowCreateObject::Procedure,
|
||||
ShowCreateObject::View,
|
||||
] {
|
||||
assert_eq!(
|
||||
mysql_and_generic().verified_stmt(format!("SHOW CREATE {} myident", obj_type).as_str()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue