[][src]Enum sqlparser::sqlast::ASTNode

pub enum ASTNode {
    SQLIdentifier(String),
    SQLAliasedExpr(Box<ASTNode>, String),
    SQLWildcard,
    SQLCompoundIdentifier(Vec<String>),
    SQLAssignment(SQLAssignment),
    SQLIsNull(Box<ASTNode>),
    SQLIsNotNull(Box<ASTNode>),
    SQLBinaryExpr {
        left: Box<ASTNode>,
        op: SQLOperator,
        right: Box<ASTNode>,
    },
    SQLCast {
        expr: Box<ASTNode>,
        data_type: SQLType,
    },
    SQLNested(Box<ASTNode>),
    SQLUnary {
        operator: SQLOperator,
        expr: Box<ASTNode>,
    },
    SQLValue(Value),
    SQLFunction {
        id: String,
        args: Vec<ASTNode>,
    },
    SQLCase {
        conditions: Vec<ASTNode>,
        results: Vec<ASTNode>,
        else_result: Option<Box<ASTNode>>,
    },
    SQLSelect {
        projection: Vec<ASTNode>,
        relation: Option<Box<ASTNode>>,
        joins: Vec<Join>,
        selection: Option<Box<ASTNode>>,
        order_by: Option<Vec<SQLOrderByExpr>>,
        group_by: Option<Vec<ASTNode>>,
        having: Option<Box<ASTNode>>,
        limit: Option<Box<ASTNode>>,
    },
    SQLInsert {
        table_name: String,
        columns: Vec<String>,
        values: Vec<Vec<ASTNode>>,
    },
    SQLCopy {
        table_name: String,
        columns: Vec<String>,
        values: Vec<Option<String>>,
    },
    SQLUpdate {
        table_name: String,
        assignments: Vec<SQLAssignment>,
        selection: Option<Box<ASTNode>>,
    },
    SQLDelete {
        relation: Option<Box<ASTNode>>,
        selection: Option<Box<ASTNode>>,
    },
    SQLCreateTable {
        name: String,
        columns: Vec<SQLColumnDef>,
    },
    SQLAlterTable {
        name: String,
        operation: AlterOperation,
    },
}

SQL Abstract Syntax Tree (AST)

Variants

SQLIdentifier(String)

Identifier e.g. table name or column name

SQLAliasedExpr(Box<ASTNode>, String)

Aliased expression

SQLWildcard

Wildcard e.g. *

SQLCompoundIdentifier(Vec<String>)

Multi part identifier e.g. myschema.dbo.mytable

SQLAssignment(SQLAssignment)

Assigment e.g. name = 'Fred' in an UPDATE statement

SQLIsNull(Box<ASTNode>)

IS NULL expression

SQLIsNotNull(Box<ASTNode>)

IS NOT NULL expression

SQLBinaryExpr

Binary expression e.g. 1 + 1 or foo > bar

Fields of SQLBinaryExpr

left: Box<ASTNode>op: SQLOperatorright: Box<ASTNode>
SQLCast

CAST an expression to a different data type e.g. CAST(foo AS VARCHAR(123))

Fields of SQLCast

expr: Box<ASTNode>data_type: SQLType
SQLNested(Box<ASTNode>)

Nested expression e.g. (foo > bar) or (1)

SQLUnary

Unary expression

Fields of SQLUnary

operator: SQLOperatorexpr: Box<ASTNode>
SQLValue(Value)

SQLValue

SQLFunction

Scalar function call e.g. LEFT(foo, 5)

Fields of SQLFunction

id: Stringargs: Vec<ASTNode>
SQLCase

CASE [] WHEN THEN ... [ELSE ] END

Fields of SQLCase

conditions: Vec<ASTNode>results: Vec<ASTNode>else_result: Option<Box<ASTNode>>
SQLSelect

SELECT

Fields of SQLSelect

projection: Vec<ASTNode>

projection expressions

relation: Option<Box<ASTNode>>

FROM

joins: Vec<Join>selection: Option<Box<ASTNode>>

WHERE

order_by: Option<Vec<SQLOrderByExpr>>

ORDER BY

group_by: Option<Vec<ASTNode>>

GROUP BY

having: Option<Box<ASTNode>>

HAVING

limit: Option<Box<ASTNode>>

LIMIT

SQLInsert

INSERT

Fields of SQLInsert

table_name: String

TABLE

columns: Vec<String>

COLUMNS

values: Vec<Vec<ASTNode>>

VALUES (vector of rows to insert)

SQLCopy

Fields of SQLCopy

table_name: String

TABLE

columns: Vec<String>

COLUMNS

values: Vec<Option<String>>

VALUES a vector of values to be copied

SQLUpdate

UPDATE

Fields of SQLUpdate

table_name: String

TABLE

assignments: Vec<SQLAssignment>

Column assignments

selection: Option<Box<ASTNode>>

WHERE

SQLDelete

DELETE

Fields of SQLDelete

relation: Option<Box<ASTNode>>

FROM

selection: Option<Box<ASTNode>>

WHERE

SQLCreateTable

CREATE TABLE

Fields of SQLCreateTable

name: String

Table name

columns: Vec<SQLColumnDef>

Optional schema

SQLAlterTable

ALTER TABLE

Fields of SQLAlterTable

name: String

Table name

operation: AlterOperation

Trait Implementations

impl Clone for ASTNode[src]

impl Debug for ASTNode[src]

impl PartialEq<ASTNode> for ASTNode[src]

impl StructuralPartialEq for ASTNode[src]

impl ToString for ASTNode[src]

Auto Trait Implementations

impl RefUnwindSafe for ASTNode

impl Send for ASTNode

impl Sync for ASTNode

impl Unpin for ASTNode

impl UnwindSafe for ASTNode

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.