query builder create progress
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#ifndef QUERY_DIALECT_HPP
|
||||
#define QUERY_DIALECT_HPP
|
||||
|
||||
#include "matador/sql/types.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
@@ -60,6 +62,7 @@ public:
|
||||
|
||||
public:
|
||||
const std::string& token_at(token_t token) const;
|
||||
const std::string& data_type_at(data_type_t type) const;
|
||||
|
||||
/**
|
||||
* Prepare sql dialect identifier for execution
|
||||
@@ -115,6 +118,7 @@ private:
|
||||
{token_t::DROP, "DROP"},
|
||||
{token_t::REMOVE, "DELETE"},
|
||||
{token_t::INSERT, "INSERT"},
|
||||
{token_t::TABLE, "TABLE"},
|
||||
{token_t::INTO, "INTO"},
|
||||
{token_t::VALUES, "VALUES"},
|
||||
{token_t::UPDATE, "UPDATE"},
|
||||
@@ -145,6 +149,31 @@ private:
|
||||
{token_t::STRING_QUOTE, "'"},
|
||||
{token_t::NONE, ""}
|
||||
};
|
||||
|
||||
using data_type_to_string_map = std::unordered_map<data_type_t, std::string>;
|
||||
data_type_to_string_map data_types_ {
|
||||
{data_type_t::type_char, "TINYINT"},
|
||||
{data_type_t::type_short, "SMALLINT"},
|
||||
{data_type_t::type_int, "INTEGER"},
|
||||
{data_type_t::type_long, "BIGINT"},
|
||||
{data_type_t::type_long_long, "BIGINT"},
|
||||
{data_type_t::type_unsigned_char, "TINYINT"},
|
||||
{data_type_t::type_unsigned_short, "INTEGER"},
|
||||
{data_type_t::type_unsigned_int, "BIGINT"},
|
||||
{data_type_t::type_unsigned_long, "BIGINT"},
|
||||
{data_type_t::type_unsigned_long_long, "BIGINT"},
|
||||
{data_type_t::type_float, "FLOAT"},
|
||||
{data_type_t::type_double, "DOUBLE"},
|
||||
{data_type_t::type_bool, "BOOLEAN"},
|
||||
{data_type_t::type_char_pointer, "VARCHAR"},
|
||||
{data_type_t::type_varchar, "VARCHAR"},
|
||||
{data_type_t::type_text, "TEXT"},
|
||||
{data_type_t::type_date, "DATE"},
|
||||
{data_type_t::type_time, "DATETIME"},
|
||||
{data_type_t::type_blob, "BLOB"},
|
||||
{data_type_t::type_null, "NULL"},
|
||||
{data_type_t::type_unknown, "UNKNOWN"}
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user