fixed PostgreSQL tests
This commit is contained in:
@@ -13,10 +13,13 @@
|
||||
#define META_TABLE(TABLE_NAME, VARIABLE_NAME, ...) \
|
||||
namespace matador::query::meta { \
|
||||
namespace internal { \
|
||||
class TABLE_NAME##_table : public table { \
|
||||
class TABLE_NAME##_table : public typed_table<TABLE_NAME##_table> { \
|
||||
public: \
|
||||
TABLE_NAME##_table() \
|
||||
: table(#TABLE_NAME, {MAP(FIELD_STRING, __VA_ARGS__)}) \
|
||||
TABLE_NAME##_table()\
|
||||
: TABLE_NAME##_table("") \
|
||||
{} \
|
||||
TABLE_NAME##_table(const std::string& alias) \
|
||||
: typed_table(#TABLE_NAME, alias, {MAP(FIELD_STRING, __VA_ARGS__)}) \
|
||||
MAP(INIT_FIELD, __VA_ARGS__) \
|
||||
{} \
|
||||
MAP(FIELD, __VA_ARGS__) \
|
||||
|
||||
@@ -40,7 +40,6 @@ public:
|
||||
protected:
|
||||
static const table_column& create_column(class table& tab, const std::string& name);
|
||||
|
||||
private:
|
||||
table(std::string name, std::string alias, const std::vector<table_column>& columns);
|
||||
|
||||
private:
|
||||
@@ -55,6 +54,13 @@ private:
|
||||
|
||||
table operator ""_tab(const char *name, size_t len);
|
||||
|
||||
template<typename Type>
|
||||
class typed_table : public table {
|
||||
public:
|
||||
using table::table;
|
||||
|
||||
Type as(std::string alias) const { return Type{std::move(alias)}; }
|
||||
};
|
||||
}
|
||||
|
||||
#endif //QUERY_TABLE_HPP
|
||||
|
||||
@@ -24,15 +24,18 @@ public:
|
||||
table_column(const class table* tab, std::string name);
|
||||
table_column(const class table* tab, std::string name, std::string alias);
|
||||
table_column(const class table* tab, std::string name, utils::basic_type type, const utils::field_attributes& attributes);
|
||||
table_column(const class table*, std::string name, std::string alias, utils::basic_type type, const utils::field_attributes& attributes);
|
||||
table_column(const class table*, std::string name, std::string alias, utils::basic_type type, const utils::field_attributes& attributes, sql::sql_function_t func = sql::sql_function_t::None);
|
||||
table_column& operator=(const table_column& other);
|
||||
table_column(const table_column& other);
|
||||
table_column(const table_column& other) = default;
|
||||
table_column(table_column&& other) noexcept = default;
|
||||
~table_column() = default;
|
||||
|
||||
[[nodiscard]] bool equals(const table_column &x) const;
|
||||
|
||||
table_column as(std::string a);
|
||||
|
||||
[[nodiscard]] const std::string& name() const;
|
||||
[[nodiscard]] std::string canonical_name() const;
|
||||
[[nodiscard]] const std::string& alias() const;
|
||||
[[nodiscard]] utils::basic_type type() const;
|
||||
[[nodiscard]] utils::field_attributes attributes() const;
|
||||
|
||||
Reference in New Issue
Block a user