added foreign_attributes class containing cascade and fetch information for foreign relations
This commit is contained in:
parent
aa221aa571
commit
fa3ea28920
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "matador/utils/access.hpp"
|
#include "matador/utils/access.hpp"
|
||||||
#include "matador/utils/field_attributes.hpp"
|
#include "matador/utils/field_attributes.hpp"
|
||||||
|
#include "matador/utils/foreign_attributes.hpp"
|
||||||
|
|
||||||
#include <typeindex>
|
#include <typeindex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -37,13 +38,13 @@ public:
|
||||||
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) {}
|
||||||
void on_attribute(const char * /*id*/, char * /*x*/, const utils::field_attributes &/*attr*/ = utils::null_attributes) {}
|
void on_attribute(const char * /*id*/, char * /*x*/, const utils::field_attributes &/*attr*/ = utils::null_attributes) {}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_has_one(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_has_one(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
data_type_t type_{};
|
data_type_t type_{};
|
||||||
|
|
@ -79,21 +80,21 @@ public:
|
||||||
void on_attribute(const char *id, std::optional<Type> &x, const utils::field_attributes &attr = utils::null_attributes);
|
void on_attribute(const char *id, std::optional<Type> &x, const utils::field_attributes &attr = utils::null_attributes);
|
||||||
|
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_belongs_to(const char *id, Pointer &x, utils::cascade_type)
|
void on_belongs_to(const char *id, Pointer &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
const auto [ref_table, ref_column] = determine_foreign_ref(std::type_index(typeid(typename Pointer::value_type)));
|
const auto [ref_table, ref_column] = determine_foreign_ref(std::type_index(typeid(typename Pointer::value_type)));
|
||||||
columns_.push_back(fk_column_generator_.generate(id, *x, ref_table, ref_column));
|
columns_.push_back(fk_column_generator_.generate(id, *x, ref_table, ref_column));
|
||||||
}
|
}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_has_one(const char *id, Pointer &x, utils::cascade_type)
|
void on_has_one(const char *id, Pointer &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
const auto [ref_table, ref_column] = determine_foreign_ref(std::type_index(typeid(typename Pointer::value_type)));
|
const auto [ref_table, ref_column] = determine_foreign_ref(std::type_index(typeid(typename Pointer::value_type)));
|
||||||
columns_.push_back(fk_column_generator_.generate(id, *x, ref_table, ref_column));
|
columns_.push_back(fk_column_generator_.generate(id, *x, ref_table, ref_column));
|
||||||
}
|
}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::pair<std::string, std::string> determine_foreign_ref(const std::type_index &ti);
|
std::pair<std::string, std::string> determine_foreign_ref(const std::type_index &ti);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "matador/utils/access.hpp"
|
#include "matador/utils/access.hpp"
|
||||||
#include "matador/utils/field_attributes.hpp"
|
#include "matador/utils/field_attributes.hpp"
|
||||||
|
#include "matador/utils/foreign_attributes.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
@ -42,19 +43,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_belongs_to(const char *id, Pointer &, utils::cascade_type)
|
void on_belongs_to(const char *id, Pointer &, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
column_names_.emplace_back(id);
|
column_names_.emplace_back(id);
|
||||||
}
|
}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_has_one(const char *id, Pointer &, utils::cascade_type)
|
void on_has_one(const char *id, Pointer &, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
column_names_.emplace_back(id);
|
column_names_.emplace_back(id);
|
||||||
}
|
}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<std::string> &column_names_;
|
std::vector<std::string> &column_names_;
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,13 @@ public:
|
||||||
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) {}
|
||||||
void on_attribute(const char * /*id*/, char * /*x*/, const utils::field_attributes &/*attr*/ = utils::null_attributes) {}
|
void on_attribute(const char * /*id*/, char * /*x*/, const utils::field_attributes &/*attr*/ = utils::null_attributes) {}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class Pointer>
|
template<class Pointer>
|
||||||
void on_has_one(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_has_one(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -40,19 +40,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Type, template < class ... > class Pointer>
|
template<class Type, template < class ... > class Pointer>
|
||||||
void on_belongs_to(const char *id, Pointer<Type> &x, utils::cascade_type)
|
void on_belongs_to(const char *id, Pointer<Type> &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
result_.emplace_back(id, fk_value_extractor_.extract(*x));
|
result_.emplace_back(id, fk_value_extractor_.extract(*x));
|
||||||
}
|
}
|
||||||
template<class Type, template < class ... > class Pointer>
|
template<class Type, template < class ... > class Pointer>
|
||||||
void on_has_one(const char *id, Pointer<Type> &x, utils::cascade_type)
|
void on_has_one(const char *id, Pointer<Type> &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
result_.emplace_back(id, fk_value_extractor_.extract(*x));
|
result_.emplace_back(id, fk_value_extractor_.extract(*x));
|
||||||
}
|
}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
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_;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "matador/utils/access.hpp"
|
#include "matador/utils/access.hpp"
|
||||||
#include "matador/utils/field_attributes.hpp"
|
#include "matador/utils/field_attributes.hpp"
|
||||||
|
#include "matador/utils/foreign_attributes.hpp"
|
||||||
|
|
||||||
#include "matador/sql/any_type.hpp"
|
#include "matador/sql/any_type.hpp"
|
||||||
#include "matador/sql/query_result_reader.hpp"
|
#include "matador/sql/query_result_reader.hpp"
|
||||||
|
|
@ -35,14 +36,14 @@ public:
|
||||||
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) {}
|
||||||
template < class Pointer >
|
template < class Pointer >
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_belongs_to(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template < class Pointer >
|
template < class Pointer >
|
||||||
void on_has_one(const char * /*id*/, Pointer &/*x*/, utils::cascade_type) {}
|
void on_has_one(const char * /*id*/, Pointer &/*x*/, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t column_index_{};
|
size_t column_index_{};
|
||||||
|
|
@ -74,7 +75,7 @@ public:
|
||||||
void on_attribute(const char *id, any_type &value, data_type_t type, const utils::field_attributes &attr = utils::null_attributes);
|
void on_attribute(const char *id, any_type &value, data_type_t type, const utils::field_attributes &attr = utils::null_attributes);
|
||||||
|
|
||||||
template < class Pointer >
|
template < class Pointer >
|
||||||
void on_belongs_to(const char * /*id*/, Pointer &x, utils::cascade_type)
|
void on_belongs_to(const char * /*id*/, Pointer &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
if (!x.get()) {
|
if (!x.get()) {
|
||||||
x.reset(new typename Pointer::value_type);
|
x.reset(new typename Pointer::value_type);
|
||||||
|
|
@ -82,7 +83,7 @@ public:
|
||||||
pk_reader_.read(*x, column_index_++);
|
pk_reader_.read(*x, column_index_++);
|
||||||
}
|
}
|
||||||
template < class Pointer >
|
template < class Pointer >
|
||||||
void on_has_one(const char * /*id*/, Pointer &x, utils::cascade_type)
|
void on_has_one(const char * /*id*/, Pointer &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
if (!x.get()) {
|
if (!x.get()) {
|
||||||
x.reset(new typename Pointer::value_type);
|
x.reset(new typename Pointer::value_type);
|
||||||
|
|
@ -91,9 +92,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void bind(const Type &) {}
|
void bind(const Type &) {}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
#include "matador/sql/fk_value_extractor.hpp"
|
#include "matador/sql/fk_value_extractor.hpp"
|
||||||
#include "matador/sql/data_type_traits.hpp"
|
#include "matador/sql/data_type_traits.hpp"
|
||||||
|
|
||||||
|
#include "matador/utils/foreign_attributes.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace matador::sql {
|
namespace matador::sql {
|
||||||
|
|
@ -41,19 +43,19 @@ public:
|
||||||
void on_attribute(const char *id, std::string &x, const utils::field_attributes &/*attr*/ = utils::null_attributes);
|
void on_attribute(const char *id, std::string &x, const utils::field_attributes &/*attr*/ = utils::null_attributes);
|
||||||
|
|
||||||
template<class Type, template < class ... > class Pointer>
|
template<class Type, template < class ... > class Pointer>
|
||||||
void on_belongs_to(const char * /*id*/, Pointer<Type> &x, utils::cascade_type)
|
void on_belongs_to(const char * /*id*/, Pointer<Type> &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
values_.emplace_back(fk_value_extractor_.extract(*x));
|
values_.emplace_back(fk_value_extractor_.extract(*x));
|
||||||
}
|
}
|
||||||
template<class Type, template < class ... > class Pointer>
|
template<class Type, template < class ... > class Pointer>
|
||||||
void on_has_one(const char * /*id*/, Pointer<Type> &x, utils::cascade_type)
|
void on_has_one(const char * /*id*/, Pointer<Type> &x, const utils::foreign_attributes &/*attr*/)
|
||||||
{
|
{
|
||||||
values_.emplace_back(fk_value_extractor_.extract(*x));
|
values_.emplace_back(fk_value_extractor_.extract(*x));
|
||||||
}
|
}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, const char *, const char *, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const char *, const char *, const utils::foreign_attributes &/*attr*/) {}
|
||||||
template<class ContainerType>
|
template<class ContainerType>
|
||||||
void on_has_many(const char *, ContainerType &, utils::cascade_type) {}
|
void on_has_many(const char *, ContainerType &, const utils::foreign_attributes &/*attr*/) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef QUERY_ACCESS_HPP
|
#ifndef QUERY_ACCESS_HPP
|
||||||
#define QUERY_ACCESS_HPP
|
#define QUERY_ACCESS_HPP
|
||||||
|
|
||||||
#include "matador/utils/cascade_type.hpp"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
|
@ -12,6 +10,7 @@ template < class Type, template < class ... > class ContainerType >
|
||||||
class container;
|
class container;
|
||||||
|
|
||||||
class field_attributes;
|
class field_attributes;
|
||||||
|
class foreign_attributes;
|
||||||
|
|
||||||
namespace access {
|
namespace access {
|
||||||
|
|
||||||
|
|
@ -56,23 +55,23 @@ void attribute(Operator &op, const char *id, Type &value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Operator, class Type>
|
template<class Operator, class Type>
|
||||||
void has_one(Operator &op, const char *id, Type &value, cascade_type cascade) {
|
void has_one(Operator &op, const char *id, Type &value, const foreign_attributes &attr) {
|
||||||
op.on_has_one(id, value, cascade);
|
op.on_has_one(id, value, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Operator, class Type>
|
template<class Operator, class Type>
|
||||||
void belongs_to(Operator &op, const char *id, Type &value, cascade_type cascade) {
|
void belongs_to(Operator &op, const char *id, Type &value, const foreign_attributes &attr) {
|
||||||
op.on_belongs_to(id, value, cascade);
|
op.on_belongs_to(id, value, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Operator, class Type, template<class ...> class ContainerType>
|
template<class Operator, class Type, template<class ...> class ContainerType>
|
||||||
void has_many(Operator &op, const char *id, container<Type, ContainerType> &container, cascade_type cascade) {
|
void has_many(Operator &op, const char *id, container<Type, ContainerType> &container, const foreign_attributes &attr) {
|
||||||
op.on_has_many(id, container, cascade);
|
op.on_has_many(id, container, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Operator, class Type, template<class ...> class ContainerType>
|
template<class Operator, class Type, template<class ...> class ContainerType>
|
||||||
void has_many(Operator &op, const char *id, container<Type, ContainerType> &container, const char *left_column, const char *right_column, cascade_type cascade) {
|
void has_many(Operator &op, const char *id, container<Type, ContainerType> &container, const char *left_column, const char *right_column, const foreign_attributes &attr) {
|
||||||
op.on_has_many(id, container, left_column, right_column, cascade);
|
op.on_has_many(id, container, left_column, right_column, attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef QUERY_FETCH_TYPE_HPP
|
||||||
|
#define QUERY_FETCH_TYPE_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Defines fetch types
|
||||||
|
*
|
||||||
|
* Defines fetch types for foreign relations
|
||||||
|
*/
|
||||||
|
enum class fetch_type : uint8_t
|
||||||
|
{
|
||||||
|
LAZY, /**< Indicates lazy fetch */
|
||||||
|
EAGER /**< Indicates eager fetch */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //QUERY_FETCH_TYPE_HPP
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef QUERY_FOREIGN_ATTRIBUTES_HPP
|
||||||
|
#define QUERY_FOREIGN_ATTRIBUTES_HPP
|
||||||
|
|
||||||
|
#include "matador/utils/fetch_type.hpp"
|
||||||
|
#include "matador/utils/cascade_type.hpp"
|
||||||
|
|
||||||
|
namespace matador::utils {
|
||||||
|
|
||||||
|
class foreign_attributes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
foreign_attributes() = default;
|
||||||
|
foreign_attributes(cascade_type cascade); // NOLINT(*-explicit-constructor)
|
||||||
|
foreign_attributes(fetch_type fetch); // NOLINT(*-explicit-constructor)
|
||||||
|
foreign_attributes(cascade_type cascade, fetch_type fetch);
|
||||||
|
foreign_attributes(const foreign_attributes &x) = default;
|
||||||
|
foreign_attributes& operator=(const foreign_attributes &x) = default;
|
||||||
|
foreign_attributes(foreign_attributes &&x) = default;
|
||||||
|
foreign_attributes& operator=(foreign_attributes &&x) = default;
|
||||||
|
~foreign_attributes() = default;
|
||||||
|
|
||||||
|
[[nodiscard]] cascade_type cascade() const;
|
||||||
|
[[nodiscard]] fetch_type fetch() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
cascade_type cascade_{cascade_type::NONE};
|
||||||
|
fetch_type fetch_{fetch_type::LAZY};
|
||||||
|
};
|
||||||
|
|
||||||
|
const foreign_attributes default_foreign_attributes {};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //QUERY_FOREIGN_ATTRIBUTES_HPP
|
||||||
|
|
@ -82,7 +82,9 @@ set(UTILS_HEADER
|
||||||
../include/matador/utils/cascade_type.hpp
|
../include/matador/utils/cascade_type.hpp
|
||||||
../include/matador/utils/logger.hpp
|
../include/matador/utils/logger.hpp
|
||||||
../include/matador/utils/enum_mapper.hpp
|
../include/matador/utils/enum_mapper.hpp
|
||||||
../include/matador/utils/types.hpp)
|
../include/matador/utils/types.hpp
|
||||||
|
../include/matador/utils/foreign_attributes.hpp
|
||||||
|
../include/matador/utils/fetch_type.hpp)
|
||||||
|
|
||||||
set(UTILS_SOURCES
|
set(UTILS_SOURCES
|
||||||
utils/field_attributes.cpp
|
utils/field_attributes.cpp
|
||||||
|
|
@ -92,7 +94,8 @@ set(UTILS_SOURCES
|
||||||
utils/os.cpp
|
utils/os.cpp
|
||||||
utils/identifier.cpp
|
utils/identifier.cpp
|
||||||
sql/value_extractor.cpp
|
sql/value_extractor.cpp
|
||||||
utils/logger.cpp)
|
utils/logger.cpp
|
||||||
|
utils/foreign_attributes.cpp)
|
||||||
|
|
||||||
add_library(matador STATIC ${SQL_SOURCES} ${SQL_HEADER} ${UTILS_SOURCES} ${UTILS_HEADER})
|
add_library(matador STATIC ${SQL_SOURCES} ${SQL_HEADER} ${UTILS_SOURCES} ${UTILS_HEADER})
|
||||||
target_include_directories(matador PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
target_include_directories(matador PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#include "matador/utils/foreign_attributes.hpp"
|
||||||
|
|
||||||
|
matador::utils::foreign_attributes::foreign_attributes(matador::utils::cascade_type cascade)
|
||||||
|
: cascade_(cascade) {}
|
||||||
|
|
||||||
|
matador::utils::foreign_attributes::foreign_attributes(fetch_type fetch)
|
||||||
|
: fetch_(fetch) {}
|
||||||
|
|
||||||
|
matador::utils::foreign_attributes::foreign_attributes(matador::utils::cascade_type cascade, fetch_type fetch)
|
||||||
|
: cascade_(cascade)
|
||||||
|
, fetch_(fetch ) {}
|
||||||
|
|
||||||
|
matador::utils::cascade_type matador::utils::foreign_attributes::cascade() const
|
||||||
|
{
|
||||||
|
return cascade_;
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch_type matador::utils::foreign_attributes::fetch() const
|
||||||
|
{
|
||||||
|
return fetch_;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue