usql update

usql is still very primitive..it just barely works
This commit is contained in:
2021-07-23 00:00:39 +02:00
parent 4f113ab2c5
commit 5005644d98
26 changed files with 877 additions and 472 deletions

View File

@@ -4,13 +4,15 @@
#include "table.h"
#include <string>
#include <list>
namespace usql {
class USql {
public:
USql() {};
USql() = default;
std::unique_ptr<Table> execute(const std::string &command);
@@ -18,41 +20,37 @@ private:
std::unique_ptr<Table> execute(Node &node);
std::unique_ptr<Table> execute_create_table(CreateTableNode &node);
std::unique_ptr<Table> execute_create_table_as_table(CreateTableAsSelectNode &node);
std::unique_ptr<Table> execute_insert_into_table(InsertIntoTableNode &node);
std::unique_ptr<Table> execute_select(SelectFromTableNode &node);
std::unique_ptr<Table> execute_delete(DeleteFromTableNode &node);
std::unique_ptr<Table> execute_update(UpdateTableNode &node);
std::unique_ptr<Table> execute_load(LoadIntoTableNode &node);
Table *find_table(const std::string name);
std::unique_ptr<Table> create_stmt_result_table(int code, std::string text);
std::unique_ptr<Table> execute_save(SaveTableNode &node);
private:
bool evalWhere(Node *where, Table *table,
std::vector<Row, std::allocator<Row>>::iterator &row) const;
bool evalWhere(Node *where, Table *table, Row &row) const;
std::unique_ptr<ValueNode> evalNode(Table *table, std::vector<Row, std::allocator<Row>>::iterator &row,
Node *node) const;
static std::unique_ptr<ValueNode> evalValueNode(Table *table, Row &row, Node *node);
static std::unique_ptr<ValueNode> evalDatabaseValueNode(Table *table, Row &row, Node *node);
static std::unique_ptr<ValueNode> evalLiteralValueNode(Table *table, Row &row, Node *node);
static std::unique_ptr<ValueNode> evalFunctionValueNode(Table *table, Row &row, Node *node);
bool evalRelationalOperator(const RelationalOperatorNode &filter, Table *table,
std::vector<Row, std::allocator<Row>>::iterator &row) const;
bool evalLogicalOperator(LogicalOperatorNode &node, Table *pTable,
std::vector<Row, std::allocator<Row>>::iterator &iter) const;
bool evalRelationalOperator(const RelationalOperatorNode &filter, Table *table, Row &row) const;
bool evalLogicalOperator(LogicalOperatorNode &node, Table *pTable, Row &row) const;
std::unique_ptr<ValueNode> evalArithmeticOperator(ColumnType outType, ArithmeticalOperatorNode &node, Table *table, Row &row) const;
static std::unique_ptr<Table> create_stmt_result_table(long code, const std::string& text);
static std::tuple<int, ColDefNode> getColumnDefinition(Table *table, SelectColNode *select_col_node, int col_order) ;
Table *find_table(const std::string &name);
std::unique_ptr<ValueNode> evalArithmetic(ColumnType outType, ArithmeticalOperatorNode &node, Table *table,
std::vector<Row, std::allocator<Row>>::iterator &row) const;
private:
Parser m_parser;
std::vector<Table> m_tables;
std::list<Table> m_tables;
};
}
} // namespace