moved column and table class from namespace sql to query
This commit is contained in:
@@ -90,13 +90,13 @@ utils::result<sql::query_result<sql::record>, utils::error> session::fetch_all(c
|
||||
if (!c.valid()) {
|
||||
return utils::failure(make_error(error_code::NoConnectionAvailable, "Failed to acquire connection."));
|
||||
}
|
||||
auto it = prototypes_.find(q.table.name());
|
||||
auto it = prototypes_.find(q.table_name);
|
||||
if (it == prototypes_.end()) {
|
||||
auto result = c->describe(q.table.name());
|
||||
auto result = c->describe(q.table_name);
|
||||
if (!result) {
|
||||
return utils::failure(result.err());
|
||||
}
|
||||
it = prototypes_.emplace(q.table.name(), *result).first;
|
||||
it = prototypes_.emplace(q.table_name, *result).first;
|
||||
}
|
||||
// adjust columns from given query
|
||||
for (auto &col: q.prototype) {
|
||||
@@ -175,7 +175,7 @@ query::fetchable_query session::build_select_query(entity_query_data &&data) {
|
||||
.from(*data.root_table)
|
||||
.join_left(data.joins)
|
||||
.where(std::move(data.where_clause))
|
||||
.order_by(sql::column{data.root_table, data.pk_column_name})
|
||||
.order_by({data.root_table, data.pk_column_name})
|
||||
.asc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <iostream>
|
||||
|
||||
namespace matador::orm {
|
||||
criteria_transformer::criteria_transformer(const object::repository& repo, const std::unordered_map<std::string, std::shared_ptr<sql::table>>& tables_by_name)
|
||||
criteria_transformer::criteria_transformer(const object::repository& repo, const std::unordered_map<std::string, std::shared_ptr<query::table>>& tables_by_name)
|
||||
: repo_(repo)
|
||||
, tables_by_name_(tables_by_name) {}
|
||||
|
||||
@@ -39,12 +39,12 @@ void criteria_transformer::visit( const query::not_criteria& node ) {
|
||||
}
|
||||
|
||||
void criteria_transformer::update_criteria_column(const query::abstract_column_criteria& node) const {
|
||||
const auto it = tables_by_name_.find(node.column().table()->name());
|
||||
const auto it = tables_by_name_.find(node.col().table()->name());
|
||||
if (it == tables_by_name_.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const_cast<sql::column&>(node.column()).table(it->second);
|
||||
const_cast<query::column&>(node.col()).table(it->second);
|
||||
}
|
||||
|
||||
void session_query_builder::on_revision(const char *id, uint64_t &/*rev*/) {
|
||||
@@ -70,7 +70,7 @@ std::string session_query_builder::build_alias(const char prefix, const unsigned
|
||||
return table_info_stack_.size() == 1;
|
||||
}
|
||||
|
||||
void session_query_builder::append_join(const sql::column &left, const sql::column &right) {
|
||||
void session_query_builder::append_join(const query::column &left, const query::column &right) {
|
||||
using namespace matador::query;
|
||||
entity_query_data_.joins.push_back({
|
||||
{right.table()},
|
||||
|
||||
Reference in New Issue
Block a user