better table print, order by/offset/limit improvements

This commit is contained in:
2021-08-01 10:40:47 +02:00
parent 34e432d031
commit 70c036f08c
17 changed files with 3037 additions and 60 deletions

View File

@@ -34,6 +34,7 @@ namespace usql {
save_table,
drop_table,
column_name,
offset_limit,
column_order,
column_value,
function,
@@ -62,6 +63,16 @@ namespace usql {
ColOrderNode(int index, bool asc) : Node(NodeType::column_name), col_name(""), col_index(index), ascending(asc) {}
};
struct OffsetLimitNode : Node {
int offset;
int limit;
OffsetLimitNode(int off, int lim) : Node(NodeType::offset_limit), offset(off), limit(lim) {}
};
struct SelectColNode : Node {
std::unique_ptr<Node> value;
std::string name;
@@ -227,9 +238,10 @@ namespace usql {
std::unique_ptr<std::vector<SelectColNode>> cols_names;
std::unique_ptr<Node> where;
std::vector<ColOrderNode> order_by;
OffsetLimitNode offset_limit;
SelectFromTableNode(std::string name, std::unique_ptr<std::vector<SelectColNode>> names, std::unique_ptr<Node> where_clause, std::vector<ColOrderNode> orderby) :
Node(NodeType::select_from), table_name(name), cols_names(std::move(names)), where(std::move(where_clause)), order_by(orderby) {}
SelectFromTableNode(std::string name, std::unique_ptr<std::vector<SelectColNode>> names, std::unique_ptr<Node> where_clause, std::vector<ColOrderNode> orderby, OffsetLimitNode offlim) :
Node(NodeType::select_from), table_name(name), cols_names(std::move(names)), where(std::move(where_clause)), order_by(orderby), offset_limit(offlim) {}
};
struct CreateTableAsSelectNode : Node {
@@ -303,7 +315,8 @@ namespace usql {
std::unique_ptr<Node> parse_update_table();
std::unique_ptr<Node> parse_where_clause();
std::vector<ColOrderNode> parse_orderby_clause();
std::vector<ColOrderNode> parse_order_by_clause();
OffsetLimitNode parse_offset_limit_clause();
std::unique_ptr<Node> parse_operand_node();
std::unique_ptr<Node> parse_value();