|
myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
|
The parsed form of every statement, and the functions that build it from text. More...
#include <cstddef>#include <optional>#include <string>#include <string_view>#include <variant>#include <vector>Go to the source code of this file.
Classes | |
| struct | tinysql::SelectItem |
One entry of a SELECT list: *, a column name, or a 'quoted literal' printed on every row. More... | |
| struct | tinysql::Condition |
A WHERE <column> <op> <value> test. More... | |
| struct | tinysql::SelectStmt |
SELECT <items> FROM <table> [WHERE <condition>]. More... | |
| struct | tinysql::InsertStmt |
INSERT INTO <table> VALUES (<values>). More... | |
| struct | tinysql::DeleteStmt |
DELETE FROM <table> WHERE <condition>. The WHERE is required, so a table is never emptied by accident. More... | |
| struct | tinysql::Assignment |
One <column> = <value> of an UPDATE's SET list. More... | |
| struct | tinysql::UpdateStmt |
UPDATE <table> SET <col> = <value>[, ...] WHERE <condition>. The WHERE is required, as for DELETE. More... | |
| struct | tinysql::ColumnFormatStmt |
COLUMN <name> FORMAT A<width>: the console display width of a column. More... | |
| struct | tinysql::ColumnDefinition |
One column of a CREATE TABLE: <name> CHAR(<width>) or <name> NUMBER(<width>). More... | |
| struct | tinysql::CreateTableStmt |
CREATE TABLE <table> (<column> <type>(<width>)[, ...]): adds a table to SYSTEM_TABLE. More... | |
| struct | tinysql::DescribeStmt |
DESCRIBE lists the tables; DESCRIBE <table> lists that table's columns. More... | |
| struct | tinysql::CommentStmt |
REM ..., -- ..., or an empty line: nothing to run. More... | |
Typedefs | |
| using | tinysql::Statement = std::variant< SelectStmt, InsertStmt, UpdateStmt, DeleteStmt, CreateTableStmt, ColumnFormatStmt, DescribeStmt, CommentStmt > |
| Any parsed statement: exactly one of the statement types above. | |
Functions | |
| Statement | tinysql::parseStatement (std::string_view sql) |
| Parses one statement. | |
| std::vector< std::string > | tinysql::splitStatements (std::string_view script) |
| Splits a script into statements. | |
The parsed form of every statement, and the functions that build it from text.
Definition in file Statement.hpp.
| using tinysql::Statement = typedef std::variant<SelectStmt, InsertStmt, UpdateStmt, DeleteStmt, CreateTableStmt, ColumnFormatStmt, DescribeStmt, CommentStmt> |
Any parsed statement: exactly one of the statement types above.
Session::execute() uses std::visit to call the matching run() overload.
Definition at line 96 of file Statement.hpp.
| Statement tinysql::parseStatement | ( | std::string_view | sql | ) |
Parses one statement.
| sql | The text of one statement; a trailing ; is allowed. |
| SqlError | On a syntax error; the message says what was expected and what was found. |
Definition at line 509 of file Parser.cpp.
| std::vector< std::string > tinysql::splitStatements | ( | std::string_view | script | ) |
Splits a script into statements.
| script | Any number of statements: one per line, and ; outside quotes also ends one. |
Definition at line 517 of file Parser.cpp.