removed unused code
This commit is contained in:
parent
0eb1ae9fe8
commit
d0b3ce4231
|
|
@ -2,7 +2,7 @@ CPMAddPackage("gh:catchorg/Catch2@3.7.1")
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
|
||||||
|
|
||||||
set(POSTGRES_CONNECTION_STRING "postgres://news:news@127.0.0.1:15432/matador")
|
set(POSTGRES_CONNECTION_STRING "postgres://test:test123!@127.0.0.1:5432/matador")
|
||||||
|
|
||||||
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
configure_file(Connection.hpp.in ${PROJECT_BINARY_DIR}/backends/postgres/test/connection.hpp @ONLY IMMEDIATE)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ struct job {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsigned int id{};
|
unsigned int id{};
|
||||||
matador::object::object_ptr<payload> payload;
|
matador::object::object_ptr<payload> data;
|
||||||
std::string type;
|
std::string type;
|
||||||
std::string description;
|
std::string description;
|
||||||
job_state state;
|
job_state state;
|
||||||
|
|
@ -88,7 +88,7 @@ struct job {
|
||||||
void process( Operator& op ) {
|
void process( Operator& op ) {
|
||||||
namespace field = matador::access;
|
namespace field = matador::access;
|
||||||
field::primary_key( op, "id", id );
|
field::primary_key( op, "id", id );
|
||||||
field::belongs_to( op, "payload", payload, matador::utils::default_foreign_attributes );
|
field::belongs_to( op, "payload", data, matador::utils::default_foreign_attributes );
|
||||||
field::attribute( op, "type", type, 511 );
|
field::attribute( op, "type", type, 511 );
|
||||||
field::attribute( op, "description", description, 511 );
|
field::attribute( op, "description", description, 511 );
|
||||||
field::attribute( op, "state", state );
|
field::attribute( op, "state", state );
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ public:
|
||||||
void on_has_many_to_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many_to_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char * /*join_column*/, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many(const char *, ContainerType &, const char * /*join_column*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
|
||||||
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ public:
|
||||||
}
|
}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
|
||||||
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
detail::fk_value_extractor fk_value_extractor_;
|
detail::fk_value_extractor fk_value_extractor_;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ protected:
|
||||||
virtual attribute_reader& result_binder() = 0;
|
virtual attribute_reader& result_binder() = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// detail::empty_binder empty_result_binder_;
|
|
||||||
object_result_binder object_binder_;
|
object_result_binder object_binder_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,67 +25,77 @@ class value;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace matador::sql {
|
namespace matador::sql {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
class pk_reader
|
class pk_reader {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
explicit pk_reader(query_result_reader &reader);
|
explicit pk_reader(query_result_reader &reader);
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void read(Type &obj, const size_t column_index)
|
void read(Type &obj, const size_t column_index) {
|
||||||
{
|
|
||||||
column_index_ = column_index;
|
column_index_ = column_index;
|
||||||
access::process(*this, obj);
|
access::process(*this, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
void on_primary_key(const char *id, ValueType &value, std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>>* = nullptr);
|
void on_primary_key(const char *id, ValueType &value,
|
||||||
|
std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>> * = nullptr);
|
||||||
void on_primary_key(const char *id, std::string &value, size_t size);
|
void on_primary_key(const char *id, std::string &value, size_t size);
|
||||||
void on_revision(const char * /*id*/, unsigned long long &/*rev*/) { ++column_index_; }
|
void on_revision(const char * /*id*/, unsigned long long &/*rev*/) { ++column_index_; }
|
||||||
|
|
||||||
template < class Type >
|
template<class Type>
|
||||||
void on_attribute(const char * /*id*/, Type &/*x*/, const utils::field_attributes &/*attr*/ = utils::null_attributes) { ++column_index_; }
|
void on_attribute(const char * /*id*/, Type &/*x*/,
|
||||||
template < class Pointer >
|
const utils::field_attributes &/*attr*/ = utils::null_attributes) { ++column_index_; }
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) { ++column_index_; }
|
|
||||||
template < class Pointer >
|
template<class Pointer>
|
||||||
|
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {
|
||||||
|
++column_index_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Pointer>
|
||||||
void on_has_one(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) { ++column_index_; }
|
void on_has_one(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) { ++column_index_; }
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char * /*id*/, ContainerType &, const char * /*join_column*/, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many(const char * /*id*/, ContainerType &, const char * /*join_column*/,
|
||||||
|
const utils::foreign_attributes &/*attr*/) {
|
||||||
|
}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many_to_many(const char *id, ContainerType &c, const char * /*join_column*/, const char * /*inverse_join_column*/, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many_to_many(const char *id, ContainerType &c, const char * /*join_column*/,
|
||||||
|
const char * /*inverse_join_column*/, const utils::foreign_attributes &/*attr*/) {
|
||||||
|
}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many_to_many(const char *id, ContainerType &c, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many_to_many(const char *id, ContainerType &c, const utils::foreign_attributes &/*attr*/) {
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t column_index_{};
|
size_t column_index_{};
|
||||||
query_result_reader &reader_;
|
query_result_reader &reader_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class query_result_impl
|
class query_result_impl {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
query_result_impl(std::unique_ptr<query_result_reader> &&reader, std::vector<object::attribute_definition> &&prototype, size_t column_index = 0);
|
query_result_impl(std::unique_ptr<query_result_reader> &&reader,
|
||||||
query_result_impl(std::unique_ptr<query_result_reader> &&reader, const std::vector<object::attribute_definition> &prototype, size_t column_index = 0);
|
std::vector<object::attribute_definition> &&prototype, size_t column_index = 0);
|
||||||
|
query_result_impl(std::unique_ptr<query_result_reader> &&reader,
|
||||||
|
const std::vector<object::attribute_definition> &prototype, size_t column_index = 0);
|
||||||
|
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
void on_primary_key(const char *id, ValueType &value, std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>>* = nullptr)
|
void on_primary_key(const char *id, ValueType &value,
|
||||||
{
|
std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>> * = nullptr) {
|
||||||
utils::data_type_traits<ValueType>::read_value(*reader_, id, column_index_++, value);
|
utils::data_type_traits<ValueType>::read_value(*reader_, id, column_index_++, value);
|
||||||
if (type_stack_.size() == 1) {
|
if (type_stack_.size() == 1) {
|
||||||
last_pk_ = current_pk_;
|
last_pk_ = current_pk_;
|
||||||
current_pk_ = value;
|
current_pk_ = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_primary_key(const char *id, std::string &value, size_t size);
|
void on_primary_key(const char *id, std::string &value, size_t size);
|
||||||
void on_revision(const char *id, uint64_t &rev);
|
void on_revision(const char *id, uint64_t &rev);
|
||||||
|
|
||||||
template < class Type >
|
template<class Type>
|
||||||
void on_attribute(const char *id, Type &x, const utils::field_attributes &/*attr*/ = utils::null_attributes)
|
void on_attribute(const char *id, Type &x, const utils::field_attributes &/*attr*/ = utils::null_attributes) {
|
||||||
{
|
|
||||||
utils::data_type_traits<Type>::read_value(*reader_, id, column_index_++, x);
|
utils::data_type_traits<Type>::read_value(*reader_, id, column_index_++, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -93,89 +103,81 @@ public:
|
||||||
void on_attribute(const char *id, std::string &value, const utils::field_attributes &attr = utils::null_attributes);
|
void on_attribute(const char *id, std::string &value, const utils::field_attributes &attr = utils::null_attributes);
|
||||||
void on_attribute(const char *id, utils::value &val, const utils::field_attributes &attr = utils::null_attributes);
|
void on_attribute(const char *id, utils::value &val, const utils::field_attributes &attr = utils::null_attributes);
|
||||||
|
|
||||||
template < class Pointer >
|
template<class Pointer>
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &x, const utils::foreign_attributes &attr) {
|
void on_belongs_to(const char * /*id*/, Pointer &x, const utils::foreign_attributes &attr) {
|
||||||
if (x.empty()) {
|
on_foreign_key(x, attr);
|
||||||
x.reset(new typename Pointer::value_type);
|
|
||||||
}
|
|
||||||
if (attr.fetch() == utils::fetch_type::LAZY) {
|
|
||||||
pk_reader_.read(*x, column_index_++);
|
|
||||||
} else {
|
|
||||||
const auto ti = std::type_index(typeid(*x));
|
|
||||||
type_stack_.push(ti);
|
|
||||||
access::process(*this, *x);
|
|
||||||
type_stack_.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
template < class Pointer >
|
|
||||||
|
template<class Pointer>
|
||||||
void on_has_one(const char * /*id*/, Pointer &x, const utils::foreign_attributes &attr) {
|
void on_has_one(const char * /*id*/, Pointer &x, const utils::foreign_attributes &attr) {
|
||||||
if (x.empty()) {
|
on_foreign_key(x, attr);
|
||||||
x.reset(new typename Pointer::value_type);
|
|
||||||
}
|
|
||||||
if (attr.fetch() == utils::fetch_type::LAZY) {
|
|
||||||
pk_reader_.read(*x, column_index_++);
|
|
||||||
} else {
|
|
||||||
const auto ti = std::type_index(typeid(*x));
|
|
||||||
type_stack_.push(ti);
|
|
||||||
access::process(*this, *x);
|
|
||||||
type_stack_.pop();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many_to_many(const char *, ContainerType &, const char * /*join_column*/, const char * /*inverse_join_column*/, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many_to_many(const char *, ContainerType &, const char * /*join_column*/, const char * /*inverse_join_column*/, const utils::foreign_attributes &attr) {
|
||||||
template<class ContainerType>
|
if (attr.fetch() == utils::fetch_type::LAZY) {
|
||||||
void on_has_many_to_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
|
||||||
template<class ContainerType>
|
} else {}
|
||||||
void on_has_many(const char * /*id*/, ContainerType &cont, const char * /*join_column*/, const utils::foreign_attributes &attr) {
|
|
||||||
if ( attr.fetch() == utils::fetch_type::LAZY ) {
|
|
||||||
// pk_reader_.read(*id, column_index_++);
|
|
||||||
} else {
|
|
||||||
const auto ti = std::type_index(typeid(typename ContainerType::value_type::value_type));
|
|
||||||
auto obj = std::make_unique<typename ContainerType::value_type::value_type>();
|
|
||||||
type_stack_.push(ti);
|
|
||||||
access::process(*this, *obj);
|
|
||||||
type_stack_.pop();
|
|
||||||
auto ptr = typename ContainerType::value_type(obj.release());
|
|
||||||
const auto pk = ptr.primary_key();
|
|
||||||
if (ptr.primary_key().is_valid()) {
|
|
||||||
cont.push_back(ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
void on_has_many_to_many(const char *, ContainerType &, const utils::foreign_attributes &attr) {
|
||||||
|
if (attr.fetch() == utils::fetch_type::LAZY) {
|
||||||
|
|
||||||
|
} else {}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class ContainerType>
|
||||||
|
void on_has_many(const char * /*id*/, ContainerType &cont, const char * /*join_column*/,
|
||||||
|
const utils::foreign_attributes &attr) {
|
||||||
|
if (attr.fetch() == utils::fetch_type::LAZY) {
|
||||||
|
// pk_reader_.read(*id, column_index_++);
|
||||||
|
} else {
|
||||||
|
const auto ti = std::type_index(typeid(typename ContainerType::value_type::value_type));
|
||||||
|
auto obj = std::make_unique<typename ContainerType::value_type::value_type>();
|
||||||
|
type_stack_.push(ti);
|
||||||
|
access::process(*this, *obj);
|
||||||
|
type_stack_.pop();
|
||||||
|
auto ptr = typename ContainerType::value_type(obj.release());
|
||||||
|
const auto pk = ptr.primary_key();
|
||||||
|
if (ptr.primary_key().is_valid()) {
|
||||||
|
cont.push_back(ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// template<class ContainerType>
|
||||||
|
// void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void bind(const Type &obj)
|
void bind(const Type &obj) {
|
||||||
{
|
|
||||||
reader_->bind(obj);
|
reader_->bind(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool pk_has_changed() const {
|
[[nodiscard]] bool pk_has_changed() const {
|
||||||
return !last_pk_.is_null() && last_pk_ != current_pk_;
|
return !last_pk_.is_null() && last_pk_ != current_pk_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool fetch(Type &obj) {
|
bool fetch(Type &obj) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
do {
|
do {
|
||||||
if (auto fetched = reader_->fetch(); !fetched.is_ok() || !*fetched) {
|
if (auto fetched = reader_->fetch(); !fetched.is_ok() || !*fetched) {
|
||||||
return !first;
|
return !first;
|
||||||
}
|
}
|
||||||
last_pk_ = current_pk_;
|
last_pk_ = current_pk_;
|
||||||
current_pk_ = discover_current_primary_key(obj);
|
current_pk_ = discover_current_primary_key(obj);
|
||||||
if (pk_has_changed()) {
|
if (pk_has_changed()) {
|
||||||
reader_->unshift();
|
reader_->unshift();
|
||||||
last_pk_.clear();
|
last_pk_.clear();
|
||||||
current_pk_.clear();
|
current_pk_.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
type_stack_.push(typeid(Type));
|
type_stack_.emplace(typeid(Type));
|
||||||
column_index_ = reader_->start_column_index();
|
column_index_ = reader_->start_column_index();
|
||||||
access::process(*this, obj);
|
access::process(*this, obj);
|
||||||
type_stack_.pop();
|
type_stack_.pop();
|
||||||
} while (last_pk_ == current_pk_);
|
} while (last_pk_ == current_pk_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -190,14 +192,29 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] const std::vector<object::attribute_definition>& prototype() const;
|
[[nodiscard]] const std::vector<object::attribute_definition> &prototype() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class Type>
|
template<class Type>
|
||||||
utils::identifier discover_current_primary_key(const Type &obj) {
|
utils::identifier discover_current_primary_key(const Type &obj) {
|
||||||
internal::query_result_pk_resolver resolver(*reader_);
|
internal::query_result_pk_resolver resolver(*reader_);
|
||||||
return resolver.discover(obj);
|
return resolver.discover(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class Pointer>
|
||||||
|
void on_foreign_key(Pointer &x, const utils::foreign_attributes &attr) {
|
||||||
|
if (x.empty()) {
|
||||||
|
x.reset(new typename Pointer::value_type);
|
||||||
}
|
}
|
||||||
|
if (attr.fetch() == utils::fetch_type::LAZY) {
|
||||||
|
pk_reader_.read(*x, column_index_++);
|
||||||
|
} else {
|
||||||
|
const auto ti = std::type_index(typeid(*x));
|
||||||
|
type_stack_.push(ti);
|
||||||
|
access::process(*this, *x);
|
||||||
|
type_stack_.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
size_t column_index_ = 0;
|
size_t column_index_ = 0;
|
||||||
|
|
@ -210,13 +227,11 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
template<typename ValueType>
|
template<typename ValueType>
|
||||||
void pk_reader::on_primary_key(const char *id, ValueType &value, std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>> *)
|
void pk_reader::on_primary_key(const char *id, ValueType &value,
|
||||||
{
|
std::enable_if_t<std::is_integral_v<ValueType> && !std::is_same_v<bool, ValueType>> *) {
|
||||||
utils::data_type_traits<ValueType>::read_value(reader_, id, column_index_++, value);
|
utils::data_type_traits<ValueType>::read_value(reader_, id, column_index_++, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include "../../../../include/matador/query/intermediates/fetchable_query.hpp"
|
#include "matador/query/intermediates/fetchable_query.hpp"
|
||||||
|
|
||||||
#include "../../../../include/matador/sql/executor.hpp"
|
#include "matador/sql/executor.hpp"
|
||||||
#include "../../../../include/matador/sql/statement.hpp"
|
#include "matador/sql/statement.hpp"
|
||||||
|
|
||||||
namespace matador::query {
|
namespace matador::query {
|
||||||
|
|
||||||
|
|
@ -13,11 +13,6 @@ utils::result<sql::query_result<sql::record>, utils::error> fetchable_query::fet
|
||||||
.and_then([](auto &&res) {
|
.and_then([](auto &&res) {
|
||||||
return utils::ok(sql::query_result<sql::record>(std::forward<decltype(res)>(res)));
|
return utils::ok(sql::query_result<sql::record>(std::forward<decltype(res)>(res)));
|
||||||
});
|
});
|
||||||
// if (!result.is_ok()) {
|
|
||||||
// return utils::error(result.err());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return utils::ok(query_result<record>(std::move(*result)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::result<std::optional<sql::record>, utils::error> fetchable_query::fetch_one(const sql::executor &exec) const
|
utils::result<std::optional<sql::record>, utils::error> fetchable_query::fetch_one(const sql::executor &exec) const
|
||||||
|
|
|
||||||
|
|
@ -161,8 +161,8 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma
|
||||||
departments.emplace_back(new department{ 2, "Invoice", {}});
|
departments.emplace_back(new department{ 2, "Invoice", {}});
|
||||||
|
|
||||||
for (auto &&a: departments) {
|
for (auto &&a: departments) {
|
||||||
auto res = ses.insert(a.release());
|
auto res = ses.insert(a.release());
|
||||||
REQUIRE(res.is_ok());
|
REQUIRE(res.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto find_result = ses.find<department>();
|
auto find_result = ses.find<department>();
|
||||||
|
|
@ -170,8 +170,8 @@ TEST_CASE_METHOD(SessionFixture, "Use session to find all objects with one-to-ma
|
||||||
auto all_departments = find_result.release();
|
auto all_departments = find_result.release();
|
||||||
std::vector<object_ptr<department>> departments_repo;
|
std::vector<object_ptr<department>> departments_repo;
|
||||||
for (auto it = all_departments.begin(); it != all_departments.end(); ++it) {
|
for (auto it = all_departments.begin(); it != all_departments.end(); ++it) {
|
||||||
std::cout << "department: " << it->name << " (employees: " << it->employees.size() << ")\n";
|
std::cout << "department: " << it->name << " (employees: " << it->employees.size() << ")\n";
|
||||||
departments_repo.emplace_back(it.release());
|
departments_repo.emplace_back(it.release());
|
||||||
}
|
}
|
||||||
REQUIRE(departments_repo.size() == 2);
|
REQUIRE(departments_repo.size() == 2);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using namespace matador;
|
||||||
struct person {
|
struct person {
|
||||||
virtual ~person() = default;
|
virtual ~person() = default;
|
||||||
template < typename Operator >
|
template < typename Operator >
|
||||||
void process(Operator &op) {}
|
void process(Operator &/*op*/) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct student final : person {};
|
struct student final : person {};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ size_t test_result_reader::column_count() const {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *test_result_reader::column(size_t index) const {
|
const char *test_result_reader::column(size_t /*index*/) const {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,72 +20,72 @@ size_t test_result_reader::start_column_index() const {
|
||||||
|
|
||||||
void test_result_reader::unshift() {}
|
void test_result_reader::unshift() {}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, int8_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, int8_t &value) {
|
||||||
value = -8;
|
value = -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, int16_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, int16_t &value) {
|
||||||
value = -16;
|
value = -16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, int32_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, int32_t &value) {
|
||||||
value = -32;
|
value = -32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, int64_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, int64_t &value) {
|
||||||
value = -64;
|
value = -64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, uint8_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, uint8_t &value) {
|
||||||
value = 8;
|
value = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, uint16_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, uint16_t &value) {
|
||||||
value = 16;
|
value = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, uint32_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, uint32_t &value) {
|
||||||
value = 32;
|
value = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, uint64_t &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, uint64_t &value) {
|
||||||
value = 64;
|
value = 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, bool &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, bool &value) {
|
||||||
value = true;
|
value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, float &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, float &value) {
|
||||||
value = 3.141572f;
|
value = 3.141572f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, double &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, double &value) {
|
||||||
value = 2.14159265358979323846;
|
value = 2.14159265358979323846;
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, matador::time &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, matador::time &/*value*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, matador::date &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, matador::date &/*value*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, char *value, const size_t size) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, char * /*value*/, const size_t /*size*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, std::string &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, std::string &value) {
|
||||||
value = "Lorem ipsum";
|
value = "Lorem ipsum";
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, std::string &value, const size_t size) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, std::string &value, const size_t /*size*/) {
|
||||||
value = "Hello world";
|
value = "Hello world";
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, utils::blob &value) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::blob &value) {
|
||||||
value = {'b', 'l', 'o', 'b'};
|
value = {'b', 'l', 'o', 'b'};
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_result_reader::read_value(const char *id, const size_t index, utils::value &val, const size_t size) {
|
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::value &val, const size_t /*size*/) {
|
||||||
val = "value";
|
val = "value";
|
||||||
}
|
}
|
||||||
utils::attribute_reader &test_result_reader::result_binder() {
|
utils::attribute_reader &test_result_reader::result_binder() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue