use raw pointer of table in class column (progress, needs fixes in tests)

This commit is contained in:
Sascha Kühl
2025-12-15 17:31:43 +01:00
parent 9418f28348
commit 4a19322ef8
5 changed files with 27 additions and 30 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ void criteria_transformer::update_criteria_column(const query::abstract_column_c
return;
}
const_cast<query::column&>(node.col()).table(it->second);
const_cast<query::column&>(node.col()).table(it->second.get());
}
void session_query_builder::on_revision(const char *id, uint64_t &/*rev*/) {
@@ -56,7 +56,7 @@ void session_query_builder::push(const std::string &column_name) {
if (it == processed_tables_.end()) {
throw query_builder_exception{query_build_error::UnexpectedError};
}
entity_query_data_.columns.emplace_back(it->second, column_name, build_alias('c', ++column_index));
entity_query_data_.columns.emplace_back(it->second.get(), column_name, build_alias('c', ++column_index));
}
std::string session_query_builder::build_alias(const char prefix, const unsigned int count) {
+8 -10
View File
@@ -18,7 +18,7 @@ column operator ""_col(const char *name, const size_t len) {
throw std::invalid_argument("Invalid column name: multiple dots found");
}
return column{std::make_shared<table>(str.substr(0, pos)), str.substr(pos + 1)};
return column{new table(str.substr(0, pos)), str.substr(pos + 1)};
}
column::column(const char *name, const std::string& as)
@@ -26,17 +26,15 @@ column::column(const char *name, const std::string& as)
{}
column::column(std::string name, std::string as)
: table_(std::make_shared<query::table>())
, name_(std::move(name))
: name_(std::move(name))
, alias_(std::move(as)) {}
column::column(const sql::sql_function_t func, std::string name)
: table_(std::make_shared<query::table>())
, name_(std::move(name))
: name_(std::move(name))
, function_(func) {}
column::column(const std::shared_ptr<query::table>& t, std::string name, std::string as)
: table_(t)
column::column(const class table* tab, std::string name, std::string as)
: table_(tab)
, name_(std::move(name))
, alias_(std::move(as)) {
}
@@ -85,12 +83,12 @@ bool column::has_alias() const {
return !alias_.empty();
}
std::shared_ptr<table> column::table() const {
const class table* column::table() const {
return table_;
}
void column::table( const std::shared_ptr<query::table>& t ) {
table_ = t;
void column::table(const query::table* tab) {
table_ = tab;
}
column::operator const std::string&() const {