usql update

This commit is contained in:
2022-01-16 19:54:19 +01:00
parent a45423692e
commit c01571bb84
13 changed files with 347 additions and 274 deletions

View File

@@ -114,8 +114,8 @@ void USql::select_row(SelectFromTableNode &where_node,
}
bool USql::check_for_aggregate_only_functions(SelectFromTableNode &node, size_t result_cols_cnt) {
int aggregate_funcs = 0;
for (int i = 0; i < node.cols_names->size(); i++) {
size_t aggregate_funcs = 0;
for (size_t i = 0; i < node.cols_names->size(); i++) {
SelectColNode * col_node = &node.cols_names->operator[](i);
if (col_node->value->node_type == NodeType::function) {
auto func_node = static_cast<FunctionNode *>(col_node->value.get());
@@ -244,7 +244,7 @@ std::tuple<int, ColDefNode> USql::get_node_definition(Table *table, Node * node,
return std::make_tuple(-1, col_def);
} else if (func_node->function == "min" || func_node->function == "max") {
auto col_type= ColumnType::float_type;
int col_len = 1;
size_t col_len = 1;
auto & v = func_node->params[0];
if (v->node_type == NodeType::database_value) {
ColDefNode src_col_def = get_db_column_definition(table, v.get());
@@ -387,7 +387,7 @@ std::unique_ptr<Table> USql::execute_select(SelectFromTableNode &node) const {
// create result table
std::vector<ColDefNode> result_tbl_col_defs{};
std::vector<int> source_table_col_index{};
for (int i = 0; i < node.cols_names->size(); i++) {
for (size_t i = 0; i < node.cols_names->size(); i++) {
SelectColNode *col_node = &node.cols_names->operator[](i);
auto [src_tbl_col_index, rst_tbl_col_def] = get_column_definition(table, col_node, i);