renamed class attribute_definition to attribute

This commit is contained in:
Sascha Kühl
2025-11-21 09:22:00 +01:00
parent dae3c1645b
commit 758284c2b3
44 changed files with 490 additions and 491 deletions
@@ -7,7 +7,7 @@
namespace matador::query {
namespace detail {
sql::record *create_prototype(const std::vector<object::attribute_definition> &prototype) {
sql::record *create_prototype(const std::vector<object::attribute> &prototype) {
auto result = std::make_unique<sql::record>();
for (const auto &col: prototype) {
result->append({
@@ -8,11 +8,11 @@ query_create_intermediate::query_create_intermediate() {
context_->parts.push_back(std::make_unique<internal::query_create_part>());
}
executable_query query_create_intermediate::table(const class table &tab, const std::initializer_list<object::attribute_definition> columns) {
return this->table(tab, std::vector<object::attribute_definition>{columns});
executable_query query_create_intermediate::table(const class table &tab, const std::initializer_list<object::attribute> columns) {
return this->table(tab, std::vector<object::attribute>{columns});
}
executable_query query_create_intermediate::table(const class table &tab, const std::vector<object::attribute_definition> &columns) {
executable_query query_create_intermediate::table(const class table &tab, const std::vector<object::attribute> &columns) {
context_->parts.push_back(std::make_unique<internal::query_create_table_part>(tab, columns));
return {context_};
}
+2 -2
View File
@@ -344,7 +344,7 @@ void query_create_part::accept(query_part_visitor &visitor)
visitor.visit(*this);
}
query_create_table_part::query_create_table_part(class table table, std::vector<object::attribute_definition> columns)
query_create_table_part::query_create_table_part(class table table, std::vector<object::attribute> columns)
: query_part(sql::dialect_token::Table)
, table_(std::move(table))
, columns_(std::move(columns)) {}
@@ -354,7 +354,7 @@ const table &query_create_table_part::table() const
return table_;
}
const std::vector<object::attribute_definition> &query_create_table_part::columns() const
const std::vector<object::attribute> &query_create_table_part::columns() const
{
return columns_;
}
@@ -7,14 +7,14 @@ namespace matador::sql {
detail::pk_reader::pk_reader(query_result_reader &reader)
: reader_(reader) {}
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, std::vector<object::attribute_definition> &&prototype, const size_t column_index)
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, std::vector<object::attribute> &&prototype, const size_t column_index)
: column_index_(column_index)
, prototype_(std::move(prototype))
, reader_(std::move(reader))
, pk_reader_(*reader_)
{}
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, const std::vector<object::attribute_definition> &prototype, const size_t column_index)
query_result_impl::query_result_impl(std::unique_ptr<query_result_reader> &&reader, const std::vector<object::attribute> &prototype, const size_t column_index)
: column_index_(column_index)
, prototype_(prototype)
, reader_(std::move(reader))
@@ -43,7 +43,7 @@ query_result_impl::on_attribute(const char *id, utils::value &val, const utils::
reader_->read_value(id, column_index_++, val, attr.size());
}
const std::vector<object::attribute_definition>& query_result_impl::prototype() const
const std::vector<object::attribute>& query_result_impl::prototype() const
{
return prototype_;
}
+3 -3
View File
@@ -291,7 +291,7 @@ void query_compiler::visit(internal::query_create_part &/*create_part*/)
struct fk_context {
std::string column;
std::shared_ptr<object::attribute_definition> reference_column;
std::shared_ptr<object::attribute> reference_column;
};
struct column_context
@@ -300,7 +300,7 @@ struct column_context
std::vector<fk_context> foreign_contexts;
};
std::string build_create_column(const object::attribute_definition &col, const sql::dialect &d, column_context &context);
std::string build_create_column(const object::attribute &col, const sql::dialect &d, column_context &context);
void query_compiler::visit(internal::query_create_table_part &part)
{
@@ -387,7 +387,7 @@ void query_compiler::visit(internal::query_drop_table_part &part)
query_.sql += " " + build_table_name(part.token(), *dialect_, query_.table_name);
}
std::string build_create_column(const object::attribute_definition &col, const sql::dialect &d, column_context &context)
std::string build_create_column(const object::attribute &col, const sql::dialect &d, column_context &context)
{
std::string result = d.prepare_identifier_string(col.name()) + " " + d.data_type_at(col.type());
if (col.attributes().size() > 0) {