mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-10 14:02:14 +00:00
Add support for SHOW CHARSET
(#1974)
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
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
parent
bde269b56f
commit
15d8bfea62
4 changed files with 61 additions and 0 deletions
|
@ -3696,6 +3696,12 @@ pub enum Statement {
|
|||
history: bool,
|
||||
show_options: ShowStatementOptions,
|
||||
},
|
||||
// ```sql
|
||||
// SHOW {CHARACTER SET | CHARSET}
|
||||
// ```
|
||||
// [MySQL]:
|
||||
// <https://dev.mysql.com/doc/refman/8.4/en/show.html#:~:text=SHOW%20%7BCHARACTER%20SET%20%7C%20CHARSET%7D%20%5Blike_or_where%5D>
|
||||
ShowCharset(ShowCharset),
|
||||
/// ```sql
|
||||
/// SHOW OBJECTS LIKE 'line%' IN mydb.public
|
||||
/// ```
|
||||
|
@ -5680,6 +5686,7 @@ impl fmt::Display for Statement {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
Statement::ShowCharset(show_stm) => show_stm.fmt(f),
|
||||
Statement::StartTransaction {
|
||||
modes,
|
||||
begin: syntax_begin,
|
||||
|
@ -9859,6 +9866,32 @@ impl fmt::Display for ShowStatementIn {
|
|||
}
|
||||
}
|
||||
|
||||
/// A Show Charset statement
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
pub struct ShowCharset {
|
||||
/// The statement can be written as `SHOW CHARSET` or `SHOW CHARACTER SET`
|
||||
/// true means CHARSET was used and false means CHARACTER SET was used
|
||||
pub is_shorthand: bool,
|
||||
pub filter: Option<ShowStatementFilter>,
|
||||
}
|
||||
|
||||
impl fmt::Display for ShowCharset {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "SHOW")?;
|
||||
if self.is_shorthand {
|
||||
write!(f, " CHARSET")?;
|
||||
} else {
|
||||
write!(f, " CHARACTER SET")?;
|
||||
}
|
||||
if self.filter.is_some() {
|
||||
write!(f, " {}", self.filter.as_ref().unwrap())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue