compilation fixes
This commit is contained in:
parent
9c42df3f83
commit
95c555d03a
|
|
@ -4,10 +4,8 @@
|
|||
#include "matador/utils/basic_types.hpp"
|
||||
#include "matador/utils/default_type_traits.hpp"
|
||||
#include "matador/utils/field_attributes.hpp"
|
||||
#include "matador/utils/value.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace matador::object {
|
||||
|
||||
|
|
@ -95,14 +93,9 @@ public:
|
|||
return type() == utils::data_type_traits<Type>::type(attributes().size());
|
||||
}
|
||||
|
||||
private:
|
||||
using data_type_index = std::vector<utils::basic_type>;
|
||||
|
||||
private:
|
||||
friend class object_definition;
|
||||
|
||||
static const data_type_index data_type_index_;
|
||||
|
||||
std::string name_;
|
||||
std::shared_ptr<object_definition> object_{};
|
||||
attribute_options options_;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "matador/utils/error.hpp"
|
||||
#include "matador/utils/field_attributes.hpp"
|
||||
#include "matador/utils/primary_key_attribute.hpp"
|
||||
|
||||
#include "matador/utils/result.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <typeindex>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
[[nodiscard]] std::type_index type_index() const;
|
||||
[[nodiscard]] std::string name() const;
|
||||
[[nodiscard]] const object_definition& definition() const;
|
||||
[[nodiscard]] std::shared_ptr<object_definition> definition() const;
|
||||
[[nodiscard]] std::shared_ptr<attribute_definition> reference_column() const;
|
||||
|
||||
[[nodiscard]] bool has_primary_key() const;
|
||||
|
|
@ -49,13 +49,13 @@ public:
|
|||
[[nodiscard]] bool endpoints_empty() const;
|
||||
|
||||
protected:
|
||||
basic_object_info(std::shared_ptr<repository_node> node, utils::identifier &&pk, const std::shared_ptr<attribute_definition> &pk_column, object_definition &&definition);
|
||||
basic_object_info(std::shared_ptr<repository_node> node, utils::identifier &&pk, const std::shared_ptr<attribute_definition> &pk_column, const std::shared_ptr<object_definition> &definition);
|
||||
basic_object_info(std::shared_ptr<repository_node> node, utils::identifier &&pk, const std::shared_ptr<attribute_definition> &pk_column);
|
||||
basic_object_info(std::shared_ptr<repository_node> node, object_definition &&definition);
|
||||
basic_object_info(std::shared_ptr<repository_node> node, const std::shared_ptr<object_definition> &definition);
|
||||
|
||||
protected:
|
||||
std::shared_ptr<repository_node> node_; /**< prototype node of the represented object type */
|
||||
object_definition definition_;
|
||||
std::shared_ptr<object_definition> definition_;
|
||||
std::optional<utils::identifier> identifier_;
|
||||
std::shared_ptr<attribute_definition> pk_column_;
|
||||
t_endpoint_map relation_endpoints_;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "matador/object/attribute_definition.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace matador::object {
|
||||
|
|
|
|||
|
|
@ -161,7 +161,6 @@ private:
|
|||
using t_type_index_node_map = std::unordered_map<std::type_index, node_ptr>;
|
||||
|
||||
[[nodiscard]] utils::result<node_ptr, utils::error> attach_node(const node_ptr &node, const std::string &parent);
|
||||
// [[nodiscard]] utils::result<node_ptr, utils::error> attach_node(const node_ptr &node, const std::type_index &type_index);
|
||||
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::string &name) const;
|
||||
[[nodiscard]] utils::result<node_ptr, utils::error> find_node(const std::type_index &type_index) const;
|
||||
template<typename Type>
|
||||
|
|
|
|||
|
|
@ -21,18 +21,18 @@ public:
|
|||
auto node = std::shared_ptr<repository_node>(new repository_node(repo, name, typeid(Type)));
|
||||
|
||||
primary_key_resolver resolver;
|
||||
object_definition obj{name, {}};
|
||||
auto obj = std::make_shared<object_definition>(name);
|
||||
auto pk_info = resolver.resolve<Type>();
|
||||
auto ref_column = determine_reference_column(typeid(Type), name, pk_info, repo);
|
||||
const auto attributes = attribute_definition_generator::generate<Type>(repo);
|
||||
for (auto&& attr : attributes) {
|
||||
obj.append(std::move(attr));
|
||||
obj->append(std::move(attr));
|
||||
}
|
||||
auto info = std::make_unique<object_info<Type>>(
|
||||
node,
|
||||
std::move(pk_info.pk),
|
||||
ref_column,
|
||||
std::move(obj),
|
||||
obj,
|
||||
[]{ return std::make_unique<Type>(); }
|
||||
);
|
||||
node->info_ = std::move(info);
|
||||
|
|
@ -41,8 +41,8 @@ public:
|
|||
}
|
||||
|
||||
template < typename Type, typename CreatorFunc >
|
||||
static utils::result<node_ptr, utils::error> make_relation_node(object::repository& tree, const std::string& name, CreatorFunc &&creator) {
|
||||
const auto result = make_and_attach_node(tree, name, typeid(Type));
|
||||
static utils::result<node_ptr, utils::error> make_relation_node(repository& repo, const std::string& name, CreatorFunc &&creator) {
|
||||
const auto result = make_and_attach_node(repo, name, typeid(Type));
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ public:
|
|||
auto obj = creator();
|
||||
auto info = std::make_unique<object_info<Type>>(
|
||||
result.value(),
|
||||
object_definition{attribute_definition_generator::generate(*obj, tree)},
|
||||
std::make_shared<object_definition>(attribute_definition_generator::generate(*obj, repo)),
|
||||
std::move(creator)
|
||||
);
|
||||
result.value()->info_ = std::move(info);
|
||||
|
|
@ -58,7 +58,7 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
static std::shared_ptr<repository_node> make_null_node(repository& tree);
|
||||
static std::shared_ptr<repository_node> make_null_node(repository& repo);
|
||||
|
||||
repository_node(const repository_node& other) = delete;
|
||||
repository_node(repository_node&& other) = default;
|
||||
|
|
@ -81,20 +81,20 @@ public:
|
|||
return std::ref(static_cast<const object_info<Type>&>(*info_));
|
||||
}
|
||||
|
||||
[[nodiscard]] const object::repository& schema() const;
|
||||
[[nodiscard]] const repository& schema() const;
|
||||
|
||||
[[nodiscard]] bool has_children() const;
|
||||
|
||||
private:
|
||||
explicit repository_node(object::repository& tree);
|
||||
repository_node(object::repository& tree, const std::type_index& ti);
|
||||
repository_node(object::repository& tree, std::string name, const std::type_index& ti);
|
||||
explicit repository_node(repository& repo);
|
||||
repository_node(repository& repo, const std::type_index& ti);
|
||||
repository_node(repository& repo, std::string name, const std::type_index& ti);
|
||||
|
||||
void unlink();
|
||||
|
||||
static utils::result<node_ptr, utils::error> make_and_attach_node(repository& repo, const std::string& name, const std::type_index& ti);
|
||||
static std::shared_ptr<attribute_definition> determine_reference_column(const std::type_index& ti,
|
||||
object_definition& obj,
|
||||
const std::shared_ptr<object_definition>& obj,
|
||||
const primary_key_info& pk_info,
|
||||
repository& repo);
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ utils::result<object::object_ptr<Type>, utils::error> session::update( const obj
|
|||
using namespace matador::utils;
|
||||
using namespace matador::query;
|
||||
|
||||
const auto col = sql::column(info.value().get().definition().primary_key()->name());
|
||||
const auto col = column(info.value().get().definition().primary_key()->name());
|
||||
auto res = matador::query::query::update(info->get().name())
|
||||
.set(generator::column_value_pairs<Type>())
|
||||
.where(col == _)
|
||||
|
|
@ -272,7 +272,7 @@ utils::result<void, utils::error> session::remove( const object::object_ptr<Type
|
|||
using namespace matador::utils;
|
||||
using namespace matador::query;
|
||||
|
||||
const auto col = sql::column(info.value().get().definition().primary_key()->name());
|
||||
const auto col = column(info.value().get().definition().primary_key()->name());
|
||||
auto res = matador::query::query::remove()
|
||||
.from( info->get().name() )
|
||||
.where(col == _)
|
||||
|
|
@ -301,7 +301,7 @@ utils::result<object::object_ptr<Type>, utils::error> session::find(const Primar
|
|||
const auto& type_info = info.value().get();
|
||||
|
||||
session_query_builder eqb(*schema_, *this);
|
||||
const sql::column col(sql::table{type_info.reference_column()->table_name()}, type_info.reference_column()->name());
|
||||
const query::column col(query::table{type_info.reference_column()->table_name()}, type_info.reference_column()->name());
|
||||
using namespace matador::query;
|
||||
auto data = eqb.build<Type>(col == utils::_);
|
||||
if (!data.is_ok()) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,72 @@
|
|||
#ifndef MATADOR_BUILDER_HPP
|
||||
#define MATADOR_BUILDER_HPP
|
||||
|
||||
#include "matador/object/attribute_definition.hpp"
|
||||
|
||||
#include "matador/query/column.hpp"
|
||||
#include "matador/query/table.hpp"
|
||||
|
||||
#include "matador/utils/basic_types.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace matador::object {
|
||||
|
||||
class entity {
|
||||
public:
|
||||
explicit entity(std::string name)
|
||||
: name_(std::move(name)) {}
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
std::string alias_;
|
||||
};
|
||||
|
||||
class attribute {
|
||||
public:
|
||||
attribute(std::string name, const utils::basic_type type)
|
||||
: name_(std::move(name))
|
||||
, type_(type) {}
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
[[nodiscard]] utils::basic_type type() const;
|
||||
[[nodiscard]] const attribute_options& options() const;
|
||||
|
||||
private:
|
||||
friend class entity;
|
||||
|
||||
std::string name_;
|
||||
std::string alias_;
|
||||
utils::basic_type type_{};
|
||||
attribute_options options_;
|
||||
|
||||
entity* owner_{nullptr};
|
||||
};
|
||||
|
||||
class constraint {
|
||||
public:
|
||||
explicit constraint(std::string name)
|
||||
: name_(std::move(name)) {}
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
[[nodiscard]] const std::string& column_name() const;
|
||||
[[nodiscard]] const utils::constraints& type() const;
|
||||
[[nodiscard]] bool is_primary_key_constraint() const;
|
||||
[[nodiscard]] bool is_foreign_key_constraint() const;
|
||||
[[nodiscard]] bool is_unique_constraint() const;
|
||||
[[nodiscard]] const std::string& referenced_table() const;
|
||||
[[nodiscard]] const std::string& referenced_column() const;
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
std::string column_name_;
|
||||
utils::constraints type_{};
|
||||
std::string referenced_table_;
|
||||
std::string referenced_column_;
|
||||
};
|
||||
}
|
||||
namespace matador::query {
|
||||
|
||||
class column_builder {
|
||||
|
|
@ -19,10 +80,6 @@ private:
|
|||
std::string column_name;
|
||||
};
|
||||
|
||||
struct constraint {
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class table_builder {
|
||||
public:
|
||||
explicit table_builder(std::string name);
|
||||
|
|
@ -45,7 +102,7 @@ public:
|
|||
constraint_builder& references(std::string table, std::string column);
|
||||
|
||||
// ReSharper disable once CppNonExplicitConversionOperator
|
||||
operator query::constraint() const; // NOLINT(*-explicit-constructor)
|
||||
operator object::constraint() const; // NOLINT(*-explicit-constructor)
|
||||
|
||||
private:
|
||||
std::string constraint_name;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include "matador/utils/placeholder.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace matador::sql {
|
||||
class connection_impl;
|
||||
class dialect;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ enum class constraints : unsigned char {
|
|||
|
||||
inline constraints operator|(constraints a, constraints b) { return static_cast<constraints>(static_cast<unsigned int>(a) | static_cast<unsigned int>(b)); }
|
||||
inline constraints operator&(constraints a, constraints b) { return static_cast<constraints>(static_cast<unsigned int>(a) & static_cast<unsigned int>(b)); }
|
||||
inline constraints& operator|= (constraints& a, constraints b) { return (constraints&)((int&)a |= (int)b); }
|
||||
inline constraints& operator&= (constraints& a, constraints b) { return (constraints&)((int&)a &= (int)b); }
|
||||
inline constraints& operator|= (constraints& a, constraints b) { return reinterpret_cast<constraints&>(reinterpret_cast<int&>(a) |= static_cast<int>(b)); }
|
||||
inline constraints& operator&= (constraints& a, constraints b) { return reinterpret_cast<constraints&>(reinterpret_cast<int&>(a) &= static_cast<int>(b)); }
|
||||
|
||||
inline bool is_constraint_set(const constraints source, const constraints needle) { return static_cast<int>(source & needle) > 0; }
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ attribute_definition::attribute_definition( std::string name, const utils::basic
|
|||
|
||||
attribute_definition::attribute_definition(std::string name, const utils::basic_type type, const attribute_options& options, const std::shared_ptr<object_definition>& obj, const std::shared_ptr<attribute_definition>& ref_column)
|
||||
: name_( std::move( name ) )
|
||||
, object_( obj )
|
||||
, options_( options )
|
||||
, type_( type )
|
||||
, reference_column_( ref_column ) {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ namespace matador::object {
|
|||
basic_object_info::basic_object_info(std::shared_ptr<repository_node> node,
|
||||
utils::identifier &&pk,
|
||||
const std::shared_ptr<attribute_definition> &pk_column,
|
||||
object_definition &&definition)
|
||||
const std::shared_ptr<object_definition> &definition)
|
||||
: node_(std::move(node))
|
||||
, definition_(std::move(definition))
|
||||
, definition_(definition)
|
||||
, identifier_(std::move(pk))
|
||||
, pk_column_(pk_column) {
|
||||
}
|
||||
|
|
@ -24,9 +24,9 @@ basic_object_info::basic_object_info(std::shared_ptr<repository_node> node,
|
|||
}
|
||||
|
||||
basic_object_info::basic_object_info(std::shared_ptr<repository_node> node,
|
||||
object_definition &&definition)
|
||||
const std::shared_ptr<object_definition> &definition)
|
||||
: node_(std::move(node))
|
||||
, definition_(std::move(definition)) {}
|
||||
, definition_(definition) {}
|
||||
|
||||
std::type_index basic_object_info::type_index() const {
|
||||
return node_->type_index();
|
||||
|
|
@ -36,7 +36,7 @@ std::string basic_object_info::name() const {
|
|||
return node_->name();
|
||||
}
|
||||
|
||||
const object_definition &basic_object_info::definition() const {
|
||||
std::shared_ptr<object_definition> basic_object_info::definition() const {
|
||||
return definition_;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -117,25 +117,6 @@ utils::result<repository::node_ptr, utils::error> repository::attach_node(const
|
|||
return utils::ok(node);
|
||||
}
|
||||
|
||||
// utils::result<schema::node_ptr, utils::error> schema::attach_node(const std::shared_ptr<schema_node> &node,
|
||||
// const std::type_index &type_index) {
|
||||
// if (has_node(node)) {
|
||||
// return utils::failure(make_error(error_code::NodeAlreadyExists, "Node '" + node->name() + "' already exists."));
|
||||
// }
|
||||
// auto result = find_node(type_index);
|
||||
// if (!result.is_ok() && result.err().ec() != error_code::NodeNotFound) {
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// insert_node(*result, node);
|
||||
//
|
||||
// // Todo: check return value
|
||||
// nodes_by_name_.insert({node->name(), node})/*.first*/;
|
||||
// nodes_by_type_.insert({node->type_index(), node});
|
||||
//
|
||||
// return utils::ok(node);
|
||||
// }
|
||||
|
||||
utils::result<repository::node_ptr, utils::error> repository::find_node(const std::string &name) const {
|
||||
// first search in the prototype map
|
||||
const auto i = nodes_by_name_.find(name);
|
||||
|
|
|
|||
|
|
@ -4,28 +4,28 @@
|
|||
#include "matador/object/repository_node.hpp"
|
||||
|
||||
namespace matador::object {
|
||||
repository_node::repository_node(object::repository &tree)
|
||||
: repo_(tree)
|
||||
repository_node::repository_node(object::repository &repo)
|
||||
: repo_(repo)
|
||||
, type_index_(typeid(detail::null_type)){
|
||||
}
|
||||
|
||||
repository_node::repository_node(object::repository &tree, const std::type_index& ti)
|
||||
: repo_(tree)
|
||||
repository_node::repository_node(object::repository &repo, const std::type_index& ti)
|
||||
: repo_(repo)
|
||||
, type_index_(ti) {
|
||||
}
|
||||
|
||||
repository_node::repository_node(object::repository &tree, std::string name, const std::type_index& ti)
|
||||
: repo_(tree)
|
||||
repository_node::repository_node(object::repository &repo, std::string name, const std::type_index& ti)
|
||||
: repo_(repo)
|
||||
, type_index_(ti)
|
||||
, first_child_(std::shared_ptr<repository_node>(new repository_node(tree)))
|
||||
, last_child_(std::shared_ptr<repository_node>(new repository_node(tree)))
|
||||
, first_child_(std::shared_ptr<repository_node>(new repository_node(repo)))
|
||||
, last_child_(std::shared_ptr<repository_node>(new repository_node(repo)))
|
||||
, name_(std::move(name)) {
|
||||
first_child_->next_sibling_ = last_child_;
|
||||
last_child_->previous_sibling_ = first_child_;
|
||||
}
|
||||
|
||||
std::shared_ptr<repository_node> repository_node::make_null_node(object::repository &tree) {
|
||||
auto node = std::shared_ptr<repository_node>(new repository_node(tree));
|
||||
std::shared_ptr<repository_node> repository_node::make_null_node(object::repository &repo) {
|
||||
auto node = std::shared_ptr<repository_node>(new repository_node(repo));
|
||||
node->info_ = std::make_unique<null_info>(node, std::shared_ptr<attribute_definition>{});
|
||||
|
||||
return node;
|
||||
|
|
@ -104,7 +104,7 @@ utils::result<repository_node::node_ptr, utils::error> repository_node::make_and
|
|||
return repo.attach_node(node, "");
|
||||
}
|
||||
|
||||
std::shared_ptr<attribute_definition> repository_node::determine_reference_column(const std::type_index& ti, object_definition& obj, const primary_key_info& pk_info, repository& repo) {
|
||||
std::shared_ptr<attribute_definition> repository_node::determine_reference_column(const std::type_index& ti, const std::shared_ptr<object_definition>& obj, const primary_key_info& pk_info, repository& repo) {
|
||||
const auto it = repo.missing_references_.find(ti);
|
||||
if (it == repo.missing_references_.end()) {
|
||||
return std::make_shared<attribute_definition>(pk_info.pk_column_name, pk_info.type, attribute_options{utils::constraints::FOREIGN_KEY});
|
||||
|
|
@ -117,7 +117,7 @@ std::shared_ptr<attribute_definition> repository_node::determine_reference_colum
|
|||
ref_column->change_type(pk_info.type);
|
||||
ref_column->attributes() = utils::constraints::FOREIGN_KEY;
|
||||
|
||||
if (obj.name().empty()) {
|
||||
if (obj->name().empty()) {
|
||||
repo.missing_references_.insert({ti, ref_column});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ matador::utils::result<void, matador::utils::error> matador::orm::schema::create
|
|||
// std::cout << result.sql << std::endl;
|
||||
for (const auto &node: repo_) {
|
||||
auto ctx = query::query::create()
|
||||
.table(node->name(), node->info().definition().columns())
|
||||
.table(node->name(), node->info().definition()->columns())
|
||||
.compile(*c);
|
||||
|
||||
for ( const auto& [sql, command] : ctx.additional_commands ) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ utils::result<void, utils::error> session::create_schema() const {
|
|||
auto c = cache_.pool().acquire();
|
||||
for (const auto &node: *schema_) {
|
||||
auto ctx = query::query::create()
|
||||
.table(node->name(), node->info().definition().columns())
|
||||
.table(node->name(), node->info().definition()->columns())
|
||||
.compile(*c);
|
||||
|
||||
for ( const auto& [sql, command] : ctx.additional_commands ) {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ constraint_builder& constraint_builder::references( std::string table, std::stri
|
|||
return *this;
|
||||
}
|
||||
|
||||
constraint_builder::operator struct query::constraint() const {
|
||||
return {constraint_name};
|
||||
constraint_builder::operator object::constraint() const {
|
||||
return object::constraint{constraint_name};
|
||||
}
|
||||
|
||||
constraint_builder constraint( std::string name ) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "matador/object/attribute_definition.hpp"
|
||||
#include "matador/object/object_definition.hpp"
|
||||
|
||||
using namespace matador::object;
|
||||
using namespace matador::utils;
|
||||
|
|
@ -33,7 +34,7 @@ TEST_CASE("Test copy and move column", "[column]") {
|
|||
REQUIRE(c.index() == 2);
|
||||
REQUIRE(c.reference_column());
|
||||
REQUIRE(c.reference_column()->name() == "author");
|
||||
REQUIRE(c.reference_column()->table_name() == "books");
|
||||
REQUIRE(c.reference_column()->object()->name() == "books");
|
||||
REQUIRE(c.type() == basic_type::type_varchar);
|
||||
REQUIRE(c.attributes().size() == 255);
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ TEST_CASE("Test copy and move column", "[column]") {
|
|||
REQUIRE(c2.index() == 2);
|
||||
REQUIRE(c2.reference_column());
|
||||
REQUIRE(c2.reference_column()->name() == "author");
|
||||
REQUIRE(c2.reference_column()->table_name() == "books");
|
||||
REQUIRE(c2.reference_column()->object()->name() == "books");
|
||||
REQUIRE(c2.type() == basic_type::type_varchar);
|
||||
REQUIRE(c2.attributes().size() == 255);
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ TEST_CASE("Test copy and move column", "[column]") {
|
|||
REQUIRE(c3.index() == 2);
|
||||
REQUIRE(c3.reference_column());
|
||||
REQUIRE(c3.reference_column()->name() == "author");
|
||||
REQUIRE(c3.reference_column()->table_name() == "books");
|
||||
REQUIRE(c3.reference_column()->object()->name() == "books");
|
||||
REQUIRE(c3.type() == basic_type::type_varchar);
|
||||
REQUIRE(c3.attributes().size() == 255);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ TEST_CASE("Test field", "[field]") {
|
|||
REQUIRE(bool_val.has_value());
|
||||
REQUIRE(bool_val.value());
|
||||
|
||||
f = sql::field("name", utils::blob{ 7,8,6,5,4,3 }, sql::field_type::Attribute, 0, 1);
|
||||
f = sql::field("name", utils::blob{ 7,8,6,5,4,3 }, utils::constraints::NONE, 0, 1);
|
||||
REQUIRE(f.index() == 1);
|
||||
REQUIRE(!f.is_null());
|
||||
REQUIRE(!f.is_integer());
|
||||
|
|
|
|||
3
todo.md
3
todo.md
|
|
@ -1,5 +1,7 @@
|
|||
# Todo
|
||||
|
||||
- move `object_definition` and `attribute_definition` to `table` and `column` in query
|
||||
and add `contraint` class
|
||||
- replace mk_column with builder style (see `query/builder.hpp`)
|
||||
- fix corresponding tests
|
||||
- enhance query helper macro to look like the `book` class below
|
||||
|
|
@ -14,6 +16,7 @@
|
|||
- implement lazy loading
|
||||
- implement polymorphic class hierarchies
|
||||
- finish `schema` and `schema_repository` classes (move add/drop from `session` to `schema`)
|
||||
- implement a flag class for enumerations
|
||||
|
||||
## book class
|
||||
```cpp
|
||||
|
|
|
|||
Loading…
Reference in New Issue