moved column and table class from namespace sql to query
This commit is contained in:
@@ -6,31 +6,16 @@
|
||||
|
||||
namespace matador::sql {
|
||||
|
||||
const std::string& dialect::token_at(const dialect_token token) const
|
||||
{
|
||||
const std::string& dialect::token_at(const dialect_token token) const {
|
||||
return tokens_.at(token);
|
||||
}
|
||||
|
||||
const std::string &dialect::data_type_at(const utils::basic_type type) const
|
||||
{
|
||||
const std::string &dialect::data_type_at(const utils::basic_type type) const {
|
||||
return data_types_.at(type);
|
||||
}
|
||||
|
||||
std::string dialect::prepare_identifier(const sql::column &col) const
|
||||
{
|
||||
std::string result;
|
||||
if (!col.is_function()) {
|
||||
if (!col.table()->name().empty()) {
|
||||
result = prepare_identifier_string(col.table()->has_alias() ? col.table()->alias() : col.table()->name()) + ".";
|
||||
}
|
||||
result += prepare_identifier_string(col.column_name());
|
||||
} else {
|
||||
result = sql_func_map_.at(col.function()) + "(" + col.column_name() + ")";
|
||||
}
|
||||
if (!col.alias().empty()) {
|
||||
result += " AS " + col.alias();
|
||||
}
|
||||
return result;
|
||||
const std::string& dialect::sql_function_at(const sql_function_t func) const {
|
||||
return sql_func_map_.at(func);
|
||||
}
|
||||
|
||||
std::string dialect::table_name( const std::string& table, const std::string& schema_name ) const {
|
||||
@@ -43,25 +28,6 @@ std::string dialect::table_name( const std::string& table, const std::string& sc
|
||||
return prepare_identifier_string( schema_name ) + "." + prepare_identifier_string( table );
|
||||
}
|
||||
|
||||
std::string dialect::prepare_condition(const sql::column& col) const
|
||||
{
|
||||
std::string result;
|
||||
if (!col.is_function()) {
|
||||
// if (!col.alias.empty()) {
|
||||
// result = col.alias;
|
||||
// } else {
|
||||
if (!col.table()->name().empty()) {
|
||||
result = prepare_identifier_string(col.table()->has_alias() ? col.table()->alias() : col.table()->name()) + ".";
|
||||
}
|
||||
result += prepare_identifier_string(col.column_name());
|
||||
// }
|
||||
} else {
|
||||
result = sql_func_map_.at(col.function()) + "(" + col.column_name() + ")";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const std::string& dialect::to_string(const bool val) const
|
||||
{
|
||||
return bool_strings_[static_cast<int>(val)];
|
||||
|
||||
Reference in New Issue
Block a user