removed condition classes, functions and operators
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
#include "matador/query/basic_condition.hpp"
|
||||
|
||||
namespace matador::query {
|
||||
|
||||
std::unordered_map<basic_condition::operand_type, std::string> basic_condition::operands{
|
||||
{operand_type::EQUAL, "="},
|
||||
{operand_type::NOT_EQUAL, "<>"},
|
||||
{operand_type::LESS, "<"},
|
||||
{operand_type::LESS_EQUAL, "<="},
|
||||
{operand_type::GREATER, ">"},
|
||||
{operand_type::GREATER_EQUAL, ">="},
|
||||
{operand_type::OR, "OR"},
|
||||
{operand_type::AND, "AND"},
|
||||
{operand_type::NOT, "NOT"},
|
||||
{operand_type::IN_LIST, "IN"},
|
||||
{operand_type::LIKE, "LIKE"}
|
||||
};
|
||||
|
||||
basic_column_condition::basic_column_condition(sql::column fld, const operand_type op)
|
||||
: field_(std::move(fld)), operand(operands[op])
|
||||
{ }
|
||||
|
||||
basic_in_condition::basic_in_condition(sql::column fld)
|
||||
: field_(std::move(fld))
|
||||
{ }
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
#include "matador/query/condition.hpp"
|
||||
|
||||
namespace matador::query {
|
||||
|
||||
condition<sql::column, utils::placeholder>::condition(const sql::column &fld, const operand_type op, const utils::placeholder &val)
|
||||
: basic_column_condition(fld, op), value(val)
|
||||
{}
|
||||
|
||||
std::string condition<sql::column, utils::placeholder>::evaluate(const sql::dialect &d, sql::query_context &query) const
|
||||
{
|
||||
query.bind_vars.emplace_back(field_.name);
|
||||
return d.prepare_identifier(field_) + " " + operand + " " + d.next_placeholder(query.bind_vars);
|
||||
}
|
||||
|
||||
condition<sql::column, sql::query_context>::condition(sql::column col, const operand_type op, sql::query_context &q)
|
||||
: basic_column_condition(std::move(col), op), query_(q)
|
||||
{}
|
||||
|
||||
std::string condition<sql::column, sql::query_context>::evaluate(const sql::dialect &d, sql::query_context &/*query*/) const
|
||||
{
|
||||
std::string result(d.prepare_identifier(field_) + " " + operand + " (");
|
||||
result += query_.sql;
|
||||
result += ")";
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string condition<sql::column, sql::column>::evaluate(const sql::dialect &d, sql::query_context &/*query*/) const {
|
||||
return d.prepare_condition(field_) + " " + operand + " " + d.prepare_condition(other_column_);
|
||||
}
|
||||
|
||||
condition<sql::column, sql::query_context> in_old(const sql::column &col, sql::query_context &&q)
|
||||
{
|
||||
return {col, basic_condition::operand_type::IN_LIST, q};
|
||||
}
|
||||
|
||||
condition<sql::column, std::string> like_old(const sql::column &col, const std::string &val) {
|
||||
return { col, basic_condition::operand_type::LIKE, val };
|
||||
}
|
||||
|
||||
condition<sql::column, sql::column> operator==(const sql::column &a, const sql::column &b)
|
||||
{
|
||||
return {a, basic_condition::operand_type::EQUAL, b};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user