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
+12 -12
View File
@@ -135,8 +135,8 @@ public:
}
append_join(
query::column{table_info_stack_.top().table, table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{next->second, join_column}
query::column{table_info_stack_.top().table.get(), table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{next->second.get(), join_column}
);
}
}
@@ -172,12 +172,12 @@ public:
}
append_join(
query::column{table_info_stack_.top().table, table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{relation->second, join_column}
query::column{table_info_stack_.top().table.get(), table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{relation->second.get(), join_column}
);
append_join(
query::column{relation->second, inverse_join_column},
query::column{next->second, info.primary_key_attribute()->name()}
query::column{relation->second.get(), inverse_join_column},
query::column{next->second.get(), info.primary_key_attribute()->name()}
);
}
@@ -214,12 +214,12 @@ public:
const auto join_columns = join_columns_collector_.collect<typename ContainerType::value_type::value_type>();
append_join(
query::column{table_info_stack_.top().table, table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{relation->second, join_columns.inverse_join_column}
query::column{table_info_stack_.top().table.get(), table_info_stack_.top().info.get().primary_key_attribute()->name()},
query::column{relation->second.get(), join_columns.inverse_join_column}
);
append_join(
query::column{relation->second, join_columns.join_column},
query::column{next->second, info.primary_key_attribute()->name()}
query::column{relation->second.get(), join_columns.join_column},
query::column{next->second.get(), info.primary_key_attribute()->name()}
);
}
@@ -271,8 +271,8 @@ void session_query_builder::on_foreign_object(const char *id, Pointer &, const u
table_info_stack_.pop();
append_join(
query::column{table_info_stack_.top().table, id},
query::column{next->second, info->get().primary_key_attribute()->name()}
query::column{table_info_stack_.top().table.get(), id},
query::column{next->second.get(), info->get().primary_key_attribute()->name()}
);
} else {
push(id);
+4 -5
View File
@@ -19,8 +19,7 @@ public:
column(const char *name, const std::string& as = ""); // NOLINT(*-explicit-constructor)
column(std::string name, std::string as = ""); // NOLINT(*-explicit-constructor)
column(sql::sql_function_t func, std::string name);
// column(const class table &tab, std::string name, std::string as = "");
column(const std::shared_ptr<table> &t, std::string name, std::string as = "");
column(const class table* tab, std::string name, std::string as = "");
[[nodiscard]] bool equals(const column &x) const;
@@ -36,14 +35,14 @@ public:
[[nodiscard]] sql::sql_function_t function() const;
[[nodiscard]] bool has_alias() const;
[[nodiscard]] std::shared_ptr<class table> table() const;
void table(const std::shared_ptr<query::table>& t);
[[nodiscard]] const class table* table() const;
void table(const query::table* t);
// ReSharper disable once CppNonExplicitConversionOperator
operator const std::string&() const; // NOLINT(*-explicit-constructor)
private:
std::shared_ptr<query::table> table_;
const query::table* table_{nullptr};
std::string name_;
std::string alias_;
utils::basic_type type_{utils::basic_type::Unknown};
+1 -1
View File
@@ -10,7 +10,7 @@
namespace matador::query {
struct join_data {
std::shared_ptr<table> join_table;
table* join_table{nullptr};
std::unique_ptr<abstract_criteria> condition;
};