a bit of work on conversion functions
This commit is contained in:
16
parser.h
16
parser.h
@@ -126,8 +126,10 @@ struct ColDefNode : Node {
|
||||
struct FunctionNode : Node {
|
||||
|
||||
enum class Type {
|
||||
to_string,
|
||||
to_char,
|
||||
to_date,
|
||||
to_int,
|
||||
to_float,
|
||||
date_add,
|
||||
pp,
|
||||
lower,
|
||||
@@ -139,13 +141,15 @@ struct FunctionNode : Node {
|
||||
};
|
||||
|
||||
static Type get_function(const std::string &str) {
|
||||
if (str=="to_string") return Type::to_string;
|
||||
if (str=="to_char") return Type::to_char;
|
||||
if (str=="to_date") return Type::to_date;
|
||||
if (str=="to_int") return Type::to_int;
|
||||
if (str=="to_float") return Type::to_float;
|
||||
if (str=="date_add") return Type::date_add;
|
||||
if (str=="pp") return Type::pp;
|
||||
if (str=="lower") return Type::lower;
|
||||
if (str=="upper") return Type::upper;
|
||||
if (str=="coalesce") return Type::coalesce;
|
||||
if (str=="coalesce") return Type::coalesce;
|
||||
if (str=="min") return Type::min;
|
||||
if (str=="max") return Type::max;
|
||||
if (str=="count") return Type::count;
|
||||
@@ -154,8 +158,10 @@ struct FunctionNode : Node {
|
||||
};
|
||||
|
||||
static std::string function_name(const Type type) {
|
||||
if (type == Type::to_string) return "to_string";
|
||||
if (type == Type::to_char) return "to_char";
|
||||
if (type == Type::to_date) return "to_date";
|
||||
if (type == Type::to_int) return "to_int";
|
||||
if (type == Type::to_float) return "to_float";
|
||||
if (type == Type::date_add) return "date_add";
|
||||
if (type == Type::pp) return "pp";
|
||||
if (type == Type::lower) return "lower";
|
||||
@@ -169,7 +175,7 @@ struct FunctionNode : Node {
|
||||
};
|
||||
|
||||
|
||||
Type function;
|
||||
Type function;
|
||||
std::vector<std::unique_ptr<Node>> params;
|
||||
|
||||
FunctionNode(std::string func_name, std::vector<std::unique_ptr<Node>> pars) :
|
||||
|
||||
Reference in New Issue
Block a user