pub enum Statement {
Show 17 variants
Select(SelectStatement),
Insert(InsertStatement),
Update(UpdateStatement),
Delete(DeleteStatement),
CreateTable(CreateTableStatement),
DropTable(DropTableStatement),
SetOperation(SetOperationStatement),
AlterTable(AlterTableStatement),
CreateView(CreateViewStatement),
DropView(DropViewStatement),
Truncate(TruncateStatement),
Transaction(TransactionStatement),
Explain(ExplainStatement),
Use(UseStatement),
Merge(MergeStatement),
Expression(Expr),
Command(CommandStatement),
}Expand description
A fully parsed SQL statement.
Corresponds to the top-level node in sqlglot’s expression tree.
Variants§
Select(SelectStatement)
Insert(InsertStatement)
Update(UpdateStatement)
Delete(DeleteStatement)
CreateTable(CreateTableStatement)
DropTable(DropTableStatement)
SetOperation(SetOperationStatement)
UNION / INTERSECT / EXCEPT between queries
AlterTable(AlterTableStatement)
ALTER TABLE …
CreateView(CreateViewStatement)
CREATE VIEW …
DropView(DropViewStatement)
DROP VIEW …
Truncate(TruncateStatement)
TRUNCATE TABLE …
Transaction(TransactionStatement)
BEGIN / COMMIT / ROLLBACK
Explain(ExplainStatement)
EXPLAIN
Use(UseStatement)
USE database
Merge(MergeStatement)
MERGE INTO … USING … WHEN MATCHED / WHEN NOT MATCHED
Expression(Expr)
Raw / passthrough expression (for expressions that don’t fit a specific statement type)
Command(CommandStatement)
Catch-all for statements that the parser accepts for round-tripping
but does not model in detail (e.g. SET extra_float_digits = 0,
SHOW VARIABLES LIKE 'innodb%', GO, DECLARE @x INT = 1,
COMMENT ON COLUMN t.c IS 'x', CREATE OPERATOR FAMILY …,
vendor-specific ALTER TABLE … COMPACT 'major').
The verb (kind) preserves the original keyword(s) so the generator
can emit a literal round-trip; body is the raw rest of the
statement up to the terminating semicolon/EOF.