1#ifndef QUERY_STATEMENT_H
2#define QUERY_STATEMENT_H
42 struct BinaryExpression;
51 std::unique_ptr<BinaryExpression>
binary;
63 std::unique_ptr<Expression>
left;
65 std::unique_ptr<Expression>
right;
68 BinaryExpression(std::unique_ptr<Expression> l, std::string operation, std::unique_ptr<Expression> r)
69 :
left(std::move(l)),
op(std::move(operation)),
right(std::move(r)) {}
Definition BasicParser.h:16
StatementType
Types of SQL statements.
Definition Statement.h:15
@ Update
Definition Statement.h:18
@ Drop
Definition Statement.h:21
@ List
Definition Statement.h:22
@ Create
Definition Statement.h:20
@ Unknown
Definition Statement.h:23
@ Insert
Definition Statement.h:17
@ Select
Definition Statement.h:16
@ Delete
Definition Statement.h:19
ExpressionType
Types of expression nodes.
Definition Statement.h:30
@ Identifier
Definition Statement.h:31
@ StringLiteral
Definition Statement.h:32
@ BinaryOp
Definition Statement.h:34
@ NumericLiteral
Definition Statement.h:33
@ Wildcard
Definition Statement.h:35
BinaryExpression()=default
std::unique_ptr< Expression > right
Definition Statement.h:65
BinaryExpression(std::unique_ptr< Expression > l, std::string operation, std::unique_ptr< Expression > r)
Definition Statement.h:68
std::string op
Definition Statement.h:64
std::unique_ptr< Expression > left
Definition Statement.h:63
std::string name
Definition Statement.h:167
ForeignKeyRef references
Empty refTable means no FK.
Definition Statement.h:170
bool isPrimaryKey
Definition Statement.h:169
std::string type
Definition Statement.h:168
ColumnDefinitionStmt()
Definition Statement.h:172
ColumnDefinitionStmt(std::string n, std::string t, bool pk=false)
Definition Statement.h:173
std::vector< ColumnDefinitionStmt > columns
Definition Statement.h:183
std::string tableName
Definition Statement.h:182
CreateStatement()
Definition Statement.h:185
std::unique_ptr< WhereClause > where
Definition Statement.h:148
DeleteStatement()
Definition Statement.h:150
std::string tableName
Definition Statement.h:147
DropStatement()
Definition Statement.h:195
std::string tableName
Definition Statement.h:193
Expression()
Definition Statement.h:53
Expression(ExpressionType t, std::string val="")
Definition Statement.h:54
std::unique_ptr< BinaryExpression > binary
Definition Statement.h:51
ExpressionType type
Definition Statement.h:49
std::string value
Definition Statement.h:50
Represents a REFERENCES clause in a column definition.
Definition Statement.h:157
std::string refTable
Referenced table name.
Definition Statement.h:158
std::string refColumn
Referenced column name (may be empty).
Definition Statement.h:159
InsertStatement()
Definition Statement.h:127
std::vector< std::string > columns
Definition Statement.h:124
std::vector< Expression > values
Definition Statement.h:125
std::string tableName
Definition Statement.h:123
Represents a JOIN clause (INNER JOIN only for now).
Definition Statement.h:99
std::string leftTableCol
Left side of ON condition (e.g. "orders.user_id").
Definition Statement.h:101
std::string tableName
Joined table name.
Definition Statement.h:100
std::string rightTableCol
Right side of ON condition (e.g. "users.id").
Definition Statement.h:102
ListStatement()
Definition Statement.h:204
std::vector< JoinClause > joins
Optional JOIN clauses.
Definition Statement.h:112
std::vector< Expression > columns
Definition Statement.h:110
SelectStatement()
Definition Statement.h:115
std::unique_ptr< WhereClause > where
Definition Statement.h:113
std::string tableName
Definition Statement.h:111
Statement(StatementType t)
Definition Statement.h:91
StatementType type
Definition Statement.h:89
virtual ~Statement()=default
std::string tableName
Definition Statement.h:135
std::unique_ptr< WhereClause > where
Definition Statement.h:137
std::vector< std::pair< std::string, Expression > > assignments
Definition Statement.h:136
UpdateStatement()
Definition Statement.h:139
WhereClause(std::unique_ptr< Expression > cond)
Definition Statement.h:80
std::unique_ptr< Expression > condition
Definition Statement.h:77