has many fetch with join

This commit is contained in:
Sascha Kühl
2025-02-19 14:51:42 +01:00
parent 784f6e768d
commit 8ab8274d93
19 changed files with 264 additions and 52 deletions
+18 -3
View File
@@ -5,12 +5,27 @@
namespace matador::sql::detail {
field_type determine_field_type(const utils::constraints c) {
if (is_constraint_set(c, utils::constraints::FOREIGN_KEY)) {
return field_type::ForeignKey;
}
if (is_constraint_set(c, utils::constraints::PRIMARY_KEY)) {
return field_type::PrimaryKey;
}
return field_type::Attribute;
}
template<>
record *create_prototype<record>(const std::vector<object::attribute_definition> &prototype)
{
record *create_prototype<record>(const std::vector<object::attribute_definition> &prototype) {
auto result = std::make_unique<record>();
for (const auto &col: prototype) {
result->append({col.name(), col.type(), col.attributes().size(), col.index()});
result->append({
col.name(),
col.type(),
determine_field_type(col.attributes().options()),
col.attributes().size(),
col.index()
});
}
return result.release();
}