mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-09 21:42:05 +00:00
feat: MERGE statements: add RETURNING and OUTPUT without INTO (#2011)
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
5d5c90c77f
commit
376f47e3d1
5 changed files with 98 additions and 25 deletions
|
@ -9107,24 +9107,36 @@ impl Display for MergeClause {
|
|||
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
|
||||
pub struct OutputClause {
|
||||
pub select_items: Vec<SelectItem>,
|
||||
pub into_table: SelectInto,
|
||||
pub enum OutputClause {
|
||||
Output {
|
||||
select_items: Vec<SelectItem>,
|
||||
into_table: Option<SelectInto>,
|
||||
},
|
||||
Returning {
|
||||
select_items: Vec<SelectItem>,
|
||||
},
|
||||
}
|
||||
|
||||
impl fmt::Display for OutputClause {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let OutputClause {
|
||||
select_items,
|
||||
into_table,
|
||||
} = self;
|
||||
|
||||
write!(
|
||||
f,
|
||||
"OUTPUT {} {}",
|
||||
display_comma_separated(select_items),
|
||||
into_table
|
||||
)
|
||||
match self {
|
||||
OutputClause::Output {
|
||||
select_items,
|
||||
into_table,
|
||||
} => {
|
||||
f.write_str("OUTPUT ")?;
|
||||
display_comma_separated(select_items).fmt(f)?;
|
||||
if let Some(into_table) = into_table {
|
||||
f.write_str(" ")?;
|
||||
into_table.fmt(f)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
OutputClause::Returning { select_items } => {
|
||||
f.write_str("RETURNING ")?;
|
||||
display_comma_separated(select_items).fmt(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue