mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-17 01:07:19 +00:00
feat: allow multiple actions in one ALTER TABLE
statement (#960)
This commit is contained in:
parent
e0afd4b179
commit
25e037c50f
7 changed files with 349 additions and 326 deletions
|
@ -209,6 +209,26 @@ pub fn expr_from_projection(item: &SelectItem) -> &Expr {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn alter_table_op_with_name(stmt: Statement, expected_name: &str) -> AlterTableOperation {
|
||||
match stmt {
|
||||
Statement::AlterTable {
|
||||
name,
|
||||
if_exists,
|
||||
only: is_only,
|
||||
operations,
|
||||
} => {
|
||||
assert_eq!(name.to_string(), expected_name);
|
||||
assert!(!if_exists);
|
||||
assert!(!is_only);
|
||||
only(operations)
|
||||
}
|
||||
_ => panic!("Expected ALTER TABLE statement"),
|
||||
}
|
||||
}
|
||||
pub fn alter_table_op(stmt: Statement) -> AlterTableOperation {
|
||||
alter_table_op_with_name(stmt, "tab")
|
||||
}
|
||||
|
||||
/// Creates a `Value::Number`, panic'ing if n is not a number
|
||||
pub fn number(n: &str) -> Value {
|
||||
Value::Number(n.parse().unwrap(), false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue