87 std::optional<std::string>
table;
std::variant< SelectStmt, InsertStmt, UpdateStmt, DeleteStmt, CreateTableStmt, ColumnFormatStmt, DescribeStmt, CommentStmt > Statement
Any parsed statement: exactly one of the statement types above.
std::vector< std::string > splitStatements(std::string_view script)
Splits a script into statements.
Statement parseStatement(std::string_view sql)
Parses one statement.
One <column> = <value> of an UPDATE's SET list.
std::string column
The column to change.
std::string value
Its new value.
One column of a CREATE TABLE: <name> CHAR(<width>) or <name> NUMBER(<width>).
std::string name
The column name.
std::string type
S1 for CHAR, N1 for NUMBER: the codes SYSTEM_TABLE records.
std::size_t width
Number of characters the column occupies in every row.
A WHERE <column> <op> <value> test.
std::string value
The value to compare with (a number when both sides are integers), or the LIKE pattern.
std::string column
The column to test.
std::string op
One of = != <> < <= > >=, or LIKE.
CREATE TABLE <table> (<column> <type>(<width>)[, ...]): adds a table to SYSTEM_TABLE.
std::string table
The new table's name.
std::vector< ColumnDefinition > columns
Its columns, in file order.
DELETE FROM <table> WHERE <condition>. The WHERE is required, so a table is never emptied by accident...
Condition where
Which rows to remove.
std::string table
The table to remove rows from.
DESCRIBE lists the tables; DESCRIBE <table> lists that table's columns.
std::optional< std::string > table
The table to describe, or empty to list all tables.
INSERT INTO <table> VALUES (<values>).
std::vector< std::string > values
The values, without the ID when it is assigned automatically.
std::string table
The table to add a row to.
One entry of a SELECT list: *, a column name, or a 'quoted literal' printed on every row.
Kind
Which kind of entry this is.
@ Star
*: every column of the table.
@ Literal
A 'quoted text', printed as-is on every row.
Kind kind
Which kind of entry this is.
std::string text
The column name or the literal text (* for Kind::Star).
SELECT <items> FROM <table> [WHERE <condition>].
std::vector< SelectItem > items
What to show, in order.
std::string table
The table to read.
std::optional< Condition > where
The optional WHERE test.
UPDATE <table> SET <col> = <value>[, ...] WHERE <condition>. The WHERE is required,...
std::string table
The table to change.
std::vector< Assignment > assignments
The columns to set and their new values.
Condition where
Which rows to change.