added sql function and alias

This commit is contained in:
2023-11-22 19:57:25 +01:00
parent 145c4dc0a3
commit 72f9d28d0d
22 changed files with 356 additions and 236 deletions
+13 -1
View File
@@ -10,6 +10,8 @@
namespace matador::sql {
class column;
class dialect
{
public:
@@ -61,6 +63,7 @@ public:
using token_to_string_map = std::unordered_map<token_t, std::string>;
using data_type_to_string_map = std::unordered_map<data_type_t, std::string>;
using sql_func_to_string_map = std::unordered_map<sql_function_t, std::string>;
public:
dialect() = default;
@@ -79,7 +82,7 @@ public:
* @param str The identifier string to be prepared
* @return The prepared string
*/
std::string prepare_identifier(const std::string &str) const;
std::string prepare_identifier(const column &col) const;
/**
* Prepare string literal
@@ -196,6 +199,15 @@ private:
{data_type_t::type_null, "NULL"},
{data_type_t::type_unknown, "UNKNOWN"}
};
sql_func_to_string_map sql_func_map_ {
{sql_function_t::NONE, "NONE" },
{sql_function_t::COUNT, "COUNT" },
{sql_function_t::AVG, "AVG" },
{sql_function_t::SUM, "SUM" },
{sql_function_t::MIN, "MIN" },
{sql_function_t::MAX, "MAX" },
};
};
}