remove few TODOs

This commit is contained in:
vaclavt
2022-02-15 19:59:03 +01:00
parent 68504eb090
commit 1578c9889d
6 changed files with 187 additions and 70 deletions

View File

@@ -121,7 +121,7 @@ std::unique_ptr<ValueNode> USql::eval_value_node(Table *table, Row &row, Node *n
std::unique_ptr<ValueNode> USql::eval_database_value_node(Table *table, Row &row, Node *node) {
auto *dvl = static_cast<DatabaseValueNode *>(node);
ColDefNode col_def = table->get_column_def( dvl->col_name); // TODO optimize it to just get this def once
ColDefNode col_def = table->get_column_def(dvl->col_name); // TODO optimize it to just get this def once
ColValue &db_value = row[col_def.order];
if (db_value.isNull())
@@ -176,18 +176,17 @@ std::unique_ptr<ValueNode> USql::eval_function_value_node(Table *table, Row &row
if (evaluatedPars.empty() || evaluatedPars[0]->isNull())
return std::make_unique<NullValueNode>();
// TODO use some enum
if (fnc->function == "lower") return lower_function(evaluatedPars);
if (fnc->function == "upper") return upper_function(evaluatedPars);
if (fnc->function == "to_date") return to_date_function(evaluatedPars);
if (fnc->function == "to_string") return to_string_function(evaluatedPars);
if (fnc->function == "date_add") return date_add_function(evaluatedPars);
if (fnc->function == "pp") return pp_function(evaluatedPars);
if (fnc->function == "count") return count_function(agg_func_value, evaluatedPars);
if (fnc->function == "max") return max_function(evaluatedPars, col_def_node, agg_func_value);
if (fnc->function == "min") return min_function(evaluatedPars, col_def_node, agg_func_value);
if (fnc->function == FunctionNode::Type::lower) return lower_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::upper) return upper_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::to_date) return to_date_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::to_string) return to_string_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::date_add) return date_add_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::pp) return pp_function(evaluatedPars);
if (fnc->function == FunctionNode::Type::count) return count_function(agg_func_value, evaluatedPars);
if (fnc->function == FunctionNode::Type::max) return max_function(evaluatedPars, col_def_node, agg_func_value);
if (fnc->function == FunctionNode::Type::min) return min_function(evaluatedPars, col_def_node, agg_func_value);
throw Exception("invalid function: " + fnc->function);
throw Exception("invalid function: " + FunctionNode::function_name(fnc->function));
}