usql update

This commit is contained in:
2021-08-23 18:14:05 +02:00
parent 8d220356f2
commit 0e90d6047c
28 changed files with 1623 additions and 3774 deletions

View File

@@ -13,7 +13,6 @@ class USql {
public:
USql() = default;
std::unique_ptr<Table> execute(const std::string &command);
private:
@@ -24,6 +23,8 @@ private:
std::unique_ptr<Table> execute_load(LoadIntoTableNode &node);
std::unique_ptr<Table> execute_save(SaveTableNode &node);
std::unique_ptr<Table> execute_drop(DropTableNode &node);
static std::unique_ptr<Table> execute_set(SetNode &node);
static std::unique_ptr<Table> execute_show(ShowNode &node);
std::unique_ptr<Table> execute_insert_into_table(InsertIntoTableNode &node);
std::unique_ptr<Table> execute_select(SelectFromTableNode &node);
@@ -32,7 +33,7 @@ private:
private:
bool eval_where(Node *where, Table *table, Row &row) const;
static bool eval_where(Node *where, Table *table, Row &row) ;
static std::unique_ptr<ValueNode> eval_value_node(Table *table, Row &row, Node *node);
static std::unique_ptr<ValueNode> eval_database_value_node(Table *table, Row &row, Node *node);
@@ -40,13 +41,14 @@ private:
static std::unique_ptr<ValueNode> eval_function_value_node(Table *table, Row &row, Node *node);
bool eval_relational_operator(const RelationalOperatorNode &filter, Table *table, Row &row) const;
bool eval_logical_operator(LogicalOperatorNode &node, Table *pTable, Row &row) const;
std::unique_ptr<ValueNode> eval_arithmetic_operator(ColumnType outType, ArithmeticalOperatorNode &node, Table *table, Row &row) const;
static bool eval_relational_operator(const RelationalOperatorNode &filter, Table *table, Row &row) ;
static bool eval_logical_operator(LogicalOperatorNode &node, Table *pTable, Row &row) ;
static std::unique_ptr<ValueNode> eval_arithmetic_operator(ColumnType outType, ArithmeticalOperatorNode &node, Table *table, Row &row) ;
static std::unique_ptr<Table> create_stmt_result_table(long code, const std::string &text, long affected_rows);
static std::unique_ptr<Table> create_stmt_result_table(long code, const std::string &text, size_t affected_rows);
static std::tuple<int, ColDefNode> get_column_definition(Table *table, SelectColNode *select_col_node, int col_order) ;
static std::tuple<int, ColDefNode> get_node_definition(Table *table, Node *select_col_node, const std::string & col_name, int col_order) ;
Table *find_table(const std::string &name);
void check_table_not_exists(const std::string &name);
@@ -54,6 +56,10 @@ private:
private:
Parser m_parser;
std::list<Table> m_tables;
static void execute_distinct(SelectFromTableNode &node, Table *result) ;
static void execute_order_by(SelectFromTableNode &node, Table *table, Table *result) ;
static void execute_offset_limit(OffsetLimitNode &node, Table *result) ;
};
} // namespace