usql updates
This commit is contained in:
@@ -184,6 +184,7 @@ USql::eval_function_value_node(Table *table, Row &row, Node *node, ColDefNode *c
|
||||
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);
|
||||
@@ -287,6 +288,16 @@ std::unique_ptr<ValueNode> USql::to_date_function(const std::vector<std::unique_
|
||||
return std::make_unique<IntValueNode>(epoch_time); // No DateValueNode for now
|
||||
}
|
||||
|
||||
std::unique_ptr<ValueNode> USql::date_add_function(const std::vector<std::unique_ptr<ValueNode>> &evaluatedPars) {
|
||||
long datetime = evaluatedPars[0]->getDateValue();
|
||||
long quantity = evaluatedPars[1]->getIntegerValue();
|
||||
std::string part = evaluatedPars[2]->getStringValue();
|
||||
|
||||
long new_date = add_to_date(datetime, quantity, part);
|
||||
return std::make_unique<IntValueNode>(new_date); // No DateValueNode for now
|
||||
}
|
||||
|
||||
|
||||
std::unique_ptr<ValueNode> USql::upper_function(const std::vector<std::unique_ptr<ValueNode>> &evaluatedPars) {
|
||||
std::string str = evaluatedPars[0]->getStringValue();
|
||||
std::transform(str.begin(), str.end(), str.begin(), [](unsigned char c) -> unsigned char { return toupper(c); });
|
||||
|
||||
Reference in New Issue
Block a user