usql update

This commit is contained in:
2022-03-08 17:48:14 +01:00
parent 55ee694f6f
commit 65abc2fd07
6 changed files with 42 additions and 11 deletions

View File

@@ -239,6 +239,13 @@ std::tuple<int, ColDefNode> USql::get_node_definition(Table *table, Node * node,
// TODO get length, use get_db_column_definition
ColDefNode col_def = ColDefNode{col_name, ColumnType::varchar_type, col_order, 256, true};
return std::make_tuple(FUNCTION_CALL, col_def);
} else if (func_node->function == FunctionNode::Type::coalesce) {
// TODO handle cases here
if (func_node->params.empty()) throw Exception("Coalesce without parameters");
if (func_node->params[0]->node_type != NodeType::database_value) throw Exception("Coalesce first parameter must be database column");
ColDefNode tbl_col_def = get_db_column_definition(table, func_node->params[0].get());
ColDefNode col_def = ColDefNode{col_name, tbl_col_def.type, col_order, tbl_col_def.length, true};
return std::make_tuple(FUNCTION_CALL, col_def);
} else if (func_node->function == FunctionNode::Type::min || func_node->function == FunctionNode::Type::max) {
auto col_type= ColumnType::float_type;
size_t col_len = 1;