From 108eca4e5328e9250c2ac60cb93e82ebc3e4b606 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sascha=20K=C3=BChl?= Date: Mon, 8 Dec 2025 20:04:04 +0100 Subject: [PATCH] renamed basic_types enumerations --- backends/postgres/src/postgres_connection.cpp | 52 +++---- backends/postgres/src/postgres_dialect.cpp | 12 +- .../postgres/src/postgres_result_reader.cpp | 34 ++--- demo/object.cpp | 20 +-- demo/work.cpp | 4 +- include/matador/object/attribute.hpp | 2 +- include/matador/sql/dialect.hpp | 34 ++--- include/matador/utils/basic_types.hpp | 36 ++--- include/matador/utils/data_type_traits.hpp | 2 +- include/matador/utils/default_type_traits.hpp | 36 ++--- include/matador/utils/identifier.hpp | 2 +- include/matador/utils/value.hpp | 2 +- source/core/object/attribute.cpp | 20 +-- source/core/utils/identifier.cpp | 16 +-- source/core/utils/types.cpp | 28 ++-- source/core/utils/value.cpp | 50 +++---- source/orm/query/query_compiler.cpp | 2 +- source/orm/sql/connection.cpp | 4 +- test/backends/QueryBasicTest.cpp | 12 +- test/backends/QueryRecordTest.cpp | 130 +++++++++--------- test/backends/QueryTest.cpp | 6 +- test/core/object/AttributeGeneratorTest.cpp | 24 ++-- test/core/utils/DefaultTypeTraitsTest.cpp | 40 +++--- test/core/utils/IdentifierTest.cpp | 2 +- test/orm/query/QueryBuilderTest.cpp | 20 +-- test/orm/sql/ColumnTest.cpp | 14 +- 26 files changed, 302 insertions(+), 302 deletions(-) diff --git a/backends/postgres/src/postgres_connection.cpp b/backends/postgres/src/postgres_connection.cpp index 9aacd21..3a7346d 100644 --- a/backends/postgres/src/postgres_connection.cpp +++ b/backends/postgres/src/postgres_connection.cpp @@ -154,61 +154,61 @@ utils::result postgres_connection::execute(const std::stri utils::basic_type oid2type(const Oid oid) { switch (oid) { case 16: - return utils::basic_type::type_bool; + return utils::basic_type::Boolean; case 17: - return utils::basic_type::type_blob; + return utils::basic_type::Blob; case 18: - return utils::basic_type::type_int8; + return utils::basic_type::Int8; case 21: - return utils::basic_type::type_int16; + return utils::basic_type::Int16; case 23: - return utils::basic_type::type_int32; + return utils::basic_type::Int32; case 20: - return utils::basic_type::type_int64; + return utils::basic_type::Int64; case 25: - return utils::basic_type::type_text; + return utils::basic_type::Text; case 1043: - return utils::basic_type::type_varchar; + return utils::basic_type::Varchar; case 700: - return utils::basic_type::type_float; + return utils::basic_type::Float; case 701: - return utils::basic_type::type_double; + return utils::basic_type::Double; case 1082: - return utils::basic_type::type_date; + return utils::basic_type::Date; case 1114: - return utils::basic_type::type_time; + return utils::basic_type::Time; default: - return utils::basic_type::type_null; + return utils::basic_type::Null; } } utils::basic_type string2type(const char *type) { if (strcmp(type, "int2") == 0) { - return utils::basic_type::type_int16; + return utils::basic_type::Int16; } else if (strcmp(type, "int4") == 0) { - return utils::basic_type::type_int32; + return utils::basic_type::Int32; } else if (strcmp(type, "int8") == 0) { - return utils::basic_type::type_int64; + return utils::basic_type::Int64; } else if (strcmp(type, "bool") == 0) { - return utils::basic_type::type_bool; + return utils::basic_type::Boolean; } else if (strcmp(type, "date") == 0) { - return utils::basic_type::type_date; + return utils::basic_type::Date; } else if (strcmp(type, "timestamp") == 0) { - return utils::basic_type::type_time; + return utils::basic_type::Time; } else if (strcmp(type, "float4") == 0) { - return utils::basic_type::type_float; + return utils::basic_type::Float; } else if (strcmp(type, "float8") == 0) { - return utils::basic_type::type_double; + return utils::basic_type::Double; } else if (strncmp(type, "varchar", 7) == 0) { - return utils::basic_type::type_varchar; + return utils::basic_type::Varchar; } else if (strcmp(type, "character varying") == 0) { - return utils::basic_type::type_varchar; + return utils::basic_type::Varchar; } else if (strcmp(type, "text") == 0) { - return utils::basic_type::type_text; + return utils::basic_type::Text; } else if (strcmp(type, "bytea") == 0) { - return utils::basic_type::type_blob; + return utils::basic_type::Blob; } else { - return utils::basic_type::type_null; + return utils::basic_type::Null; } } diff --git a/backends/postgres/src/postgres_dialect.cpp b/backends/postgres/src/postgres_dialect.cpp index e607880..a8caca2 100644 --- a/backends/postgres/src/postgres_dialect.cpp +++ b/backends/postgres/src/postgres_dialect.cpp @@ -16,12 +16,12 @@ {dialect_token::BeginBinaryData, "'\\x"} }) .with_data_type_replace_map({ - {matador::utils::basic_type::type_int8, "SMALLINT"}, - {matador::utils::basic_type::type_uint8, "SMALLINT"}, - {matador::utils::basic_type::type_float, "REAL"}, - {matador::utils::basic_type::type_double, "DOUBLE PRECISION"}, - {matador::utils::basic_type::type_time, "TIMESTAMP"}, - {matador::utils::basic_type::type_blob, "BYTEA"} + {matador::utils::basic_type::Int8, "SMALLINT"}, + {matador::utils::basic_type::UInt8, "SMALLINT"}, + {matador::utils::basic_type::Float, "REAL"}, + {matador::utils::basic_type::Double, "DOUBLE PRECISION"}, + {matador::utils::basic_type::Time, "TIMESTAMP"}, + {matador::utils::basic_type::Blob, "BYTEA"} }) .with_bool_strings("TRUE", "FALSE") .with_default_schema_name("public") diff --git a/backends/postgres/src/postgres_result_reader.cpp b/backends/postgres/src/postgres_result_reader.cpp index 8b33e73..33c8bc3 100644 --- a/backends/postgres/src/postgres_result_reader.cpp +++ b/backends/postgres/src/postgres_result_reader.cpp @@ -172,41 +172,41 @@ void set_value(const char* str, utils::value& value) { void postgres_result_reader::read_value(const char * /*id*/, const size_t index, utils::value &val, size_t) { switch (val.type()) { - case utils::basic_type::type_int8: + case utils::basic_type::Int8: set_value(column(index), val); break; - case utils::basic_type::type_int16: + case utils::basic_type::Int16: set_value(column(index), val); break; - case utils::basic_type::type_int32: + case utils::basic_type::Int32: set_value(column(index), val); break; - case utils::basic_type::type_int64: + case utils::basic_type::Int64: set_value(column(index), val); break; - case utils::basic_type::type_uint8: + case utils::basic_type::UInt8: set_value(column(index), val); break; - case utils::basic_type::type_uint16: + case utils::basic_type::UInt16: set_value(column(index), val); break; - case utils::basic_type::type_uint32: + case utils::basic_type::UInt32: set_value(column(index), val); break; - case utils::basic_type::type_uint64: + case utils::basic_type::UInt64: set_value(column(index), val); break; - case utils::basic_type::type_float: + case utils::basic_type::Float: set_value(column(index), val); break; - case utils::basic_type::type_double: + case utils::basic_type::Double: set_value(column(index), val); break; - case utils::basic_type::type_bool: + case utils::basic_type::Boolean: set_value(column(index), val); break; - case utils::basic_type::type_text: - case utils::basic_type::type_varchar: { + case utils::basic_type::Text: + case utils::basic_type::Varchar: { if (const auto *column_value = column(index); column_value == nullptr) { val = std::string{}; } else { @@ -214,16 +214,16 @@ void postgres_result_reader::read_value(const char * /*id*/, const size_t index, } break; } - case utils::basic_type::type_time: - case utils::basic_type::type_date: { + case utils::basic_type::Time: + case utils::basic_type::Date: { val = std::string{column(index)}; break; } - case utils::basic_type::type_null: { + case utils::basic_type::Null: { val = nullptr_t{}; break; } - case utils::basic_type::type_blob: { + case utils::basic_type::Blob: { set_value(column(index), val); break; } diff --git a/demo/object.cpp b/demo/object.cpp index a855e7d..094976b 100644 --- a/demo/object.cpp +++ b/demo/object.cpp @@ -41,22 +41,22 @@ public: [[nodiscard]] bool is_nullable() const { return null_option_type_ == null_option_type::Nullable; } [[nodiscard]] utils::basic_type type() const { return type_; } - [[nodiscard]] bool is_integer() const { return type_ >= utils::basic_type::type_int8 && type_ <= utils::basic_type::type_uint64; } - [[nodiscard]] bool is_floating_point() const { return type_ == utils::basic_type::type_float || type_ == utils::basic_type::type_double; } - [[nodiscard]] bool is_bool() const { return type_ == utils::basic_type::type_bool; } - [[nodiscard]] bool is_string() const { return type_ == utils::basic_type::type_text; } - [[nodiscard]] bool is_varchar() const { return type_ == utils::basic_type::type_varchar; } - [[nodiscard]] bool is_date() const { return type_ == utils::basic_type::type_date; } - [[nodiscard]] bool is_time() const { return type_ == utils::basic_type::type_time; } - [[nodiscard]] bool is_blob() const { return type_ == utils::basic_type::type_blob; } - [[nodiscard]] bool is_null() const { return type_ == utils::basic_type::type_null; } + [[nodiscard]] bool is_integer() const { return type_ >= utils::basic_type::Int8 && type_ <= utils::basic_type::UInt64; } + [[nodiscard]] bool is_floating_point() const { return type_ == utils::basic_type::Float || type_ == utils::basic_type::Double; } + [[nodiscard]] bool is_bool() const { return type_ == utils::basic_type::Boolean; } + [[nodiscard]] bool is_string() const { return type_ == utils::basic_type::Text; } + [[nodiscard]] bool is_varchar() const { return type_ == utils::basic_type::Varchar; } + [[nodiscard]] bool is_date() const { return type_ == utils::basic_type::Date; } + [[nodiscard]] bool is_time() const { return type_ == utils::basic_type::Time; } + [[nodiscard]] bool is_blob() const { return type_ == utils::basic_type::Blob; } + [[nodiscard]] bool is_null() const { return type_ == utils::basic_type::Null; } private: friend class object; std::string name_; std::string alias_; - utils::basic_type type_{utils::basic_type::type_null}; + utils::basic_type type_{utils::basic_type::Null}; utils::field_attributes options_; null_option_type null_option_type_{null_option_type::NotNull}; diff --git a/demo/work.cpp b/demo/work.cpp index 72cc814..9772fdc 100644 --- a/demo/work.cpp +++ b/demo/work.cpp @@ -24,7 +24,7 @@ #include "matador/orm/session.hpp" template <> struct matador::utils::data_type_traits { - static basic_type type(std::size_t /*size*/) { return basic_type::type_uint64; } + static basic_type type(std::size_t /*size*/) { return basic_type::UInt64; } static void read_value(attribute_reader &/*reader*/, const char * /*id*/, size_t /*index*/, nullptr_t &/*value*/) { } @@ -34,7 +34,7 @@ template <> struct matador::utils::data_type_traits }; template <> struct matador::utils::data_type_traits { - static basic_type type(std::size_t /*size*/) { return basic_type::type_uint64; } + static basic_type type(std::size_t /*size*/) { return basic_type::UInt64; } static void read_value(attribute_reader &/*reader*/, const char * /*id*/, size_t /*index*/, nullptr_t &/*value*/) { } diff --git a/include/matador/object/attribute.hpp b/include/matador/object/attribute.hpp index 510484d..a0bc573 100644 --- a/include/matador/object/attribute.hpp +++ b/include/matador/object/attribute.hpp @@ -70,7 +70,7 @@ private: std::string name_; object *owner_{nullptr}; - utils::basic_type type_{utils::basic_type::type_null}; + utils::basic_type type_{utils::basic_type::Null}; utils::field_attributes options_{}; null_option_type null_option_{null_option_type::NotNull}; }; diff --git a/include/matador/sql/dialect.hpp b/include/matador/sql/dialect.hpp index 7f20150..fb6bb35 100644 --- a/include/matador/sql/dialect.hpp +++ b/include/matador/sql/dialect.hpp @@ -243,23 +243,23 @@ private: }; data_type_to_string_map data_types_ { - {utils::basic_type::type_int8, "TINYINT"}, - {utils::basic_type::type_int16, "SMALLINT"}, - {utils::basic_type::type_int32, "INTEGER"}, - {utils::basic_type::type_int64, "BIGINT"}, - {utils::basic_type::type_uint8, "TINYINT"}, - {utils::basic_type::type_uint16, "INTEGER"}, - {utils::basic_type::type_uint32, "BIGINT"}, - {utils::basic_type::type_uint64, "BIGINT"}, - {utils::basic_type::type_float, "FLOAT"}, - {utils::basic_type::type_double, "DOUBLE"}, - {utils::basic_type::type_bool, "BOOLEAN"}, - {utils::basic_type::type_varchar, "VARCHAR"}, - {utils::basic_type::type_text, "TEXT"}, - {utils::basic_type::type_date, "DATE"}, - {utils::basic_type::type_time, "DATETIME"}, - {utils::basic_type::type_blob, "BLOB"}, - {utils::basic_type::type_null, "NULL"} + {utils::basic_type::Int8, "TINYINT"}, + {utils::basic_type::Int16, "SMALLINT"}, + {utils::basic_type::Int32, "INTEGER"}, + {utils::basic_type::Int64, "BIGINT"}, + {utils::basic_type::UInt8, "TINYINT"}, + {utils::basic_type::UInt16, "INTEGER"}, + {utils::basic_type::UInt32, "BIGINT"}, + {utils::basic_type::UInt64, "BIGINT"}, + {utils::basic_type::Float, "FLOAT"}, + {utils::basic_type::Double, "DOUBLE"}, + {utils::basic_type::Boolean, "BOOLEAN"}, + {utils::basic_type::Varchar, "VARCHAR"}, + {utils::basic_type::Text, "TEXT"}, + {utils::basic_type::Date, "DATE"}, + {utils::basic_type::Time, "DATETIME"}, + {utils::basic_type::Blob, "BLOB"}, + {utils::basic_type::Null, "NULL"} }; sql_func_to_string_map sql_func_map_ { diff --git a/include/matador/utils/basic_types.hpp b/include/matador/utils/basic_types.hpp index 1884283..ffd7fce 100644 --- a/include/matador/utils/basic_types.hpp +++ b/include/matador/utils/basic_types.hpp @@ -9,24 +9,24 @@ namespace matador::utils { * @brief Enumeration type of all supported basic data types */ enum class basic_type : uint8_t { - type_int8 = 0, /*!< Data type int8 */ - type_int16, /*!< Data type int16 */ - type_int32, /*!< Data type int32 */ - type_int64, /*!< Data type int64 */ - type_uint8, /*!< Data type unsigned int8 */ - type_uint16, /*!< Data type unsigned int16 */ - type_uint32, /*!< Data type unsigned int32 */ - type_uint64, /*!< Data type unsigned int64 */ - type_float, /*!< Data type float */ - type_double, /*!< Data type double */ - type_bool, /*!< Data type bool */ - type_varchar, /*!< Data type varchar */ - type_text, /*!< Data type text */ - type_date, /*!< Data type date */ - type_time, /*!< Data type time */ - type_blob, /*!< Data type blob */ - type_null, /*!< Data type null */ - type_unknown /*!< Data type unknown */ + Int8 = 0, /*!< Data type int8 */ + Int16, /*!< Data type int16 */ + Int32, /*!< Data type int32 */ + Int64, /*!< Data type int64 */ + UInt8, /*!< Data type unsigned int8 */ + UInt16, /*!< Data type unsigned int16 */ + UInt32, /*!< Data type unsigned int32 */ + UInt64, /*!< Data type unsigned int64 */ + Float, /*!< Data type float */ + Double, /*!< Data type double */ + Boolean, /*!< Data type bool */ + Varchar, /*!< Data type varchar */ + Text, /*!< Data type text */ + Date, /*!< Data type date */ + Time, /*!< Data type time */ + Blob, /*!< Data type blob */ + Null, /*!< Data type null */ + Unknown /*!< Data type unknown */ }; } diff --git a/include/matador/utils/data_type_traits.hpp b/include/matador/utils/data_type_traits.hpp index 4b11835..ecdb5cf 100644 --- a/include/matador/utils/data_type_traits.hpp +++ b/include/matador/utils/data_type_traits.hpp @@ -20,7 +20,7 @@ class attribute_writer; */ template < class Type, class Enable = void > struct data_type_traits { - static basic_type type(std::size_t /*size*/) { return basic_type::type_unknown; } + static basic_type type(std::size_t /*size*/) { return basic_type::Unknown; } static void read_value(attribute_reader &/*reader*/, const char *id, size_t index, nullptr_t &/*value*/, size_t /*size*/ = 0) {} static void bind_value(attribute_writer &/*binder*/, size_t index, nullptr_t &/*value*/, size_t /*size*/ = 0) {} }; diff --git a/include/matador/utils/default_type_traits.hpp b/include/matador/utils/default_type_traits.hpp index 6055467..d3584e1 100644 --- a/include/matador/utils/default_type_traits.hpp +++ b/include/matador/utils/default_type_traits.hpp @@ -12,105 +12,105 @@ namespace matador::utils { /// @cond MATADOR_DEV template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/) { return basic_type::type_null; } + static basic_type type(std::size_t /*size*/) { return basic_type::Null; } static void read_value(attribute_reader &reader, const char *id, size_t index, nullptr_t &/*value*/, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, nullptr_t &/*value*/, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_int8; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Int8; } static void read_value(attribute_reader &reader, const char *id, size_t index, int8_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const int8_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_int16; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Int16; } static void read_value(attribute_reader &reader, const char *id, size_t index, int16_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const int16_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_int32; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Int32; } static void read_value(attribute_reader &reader, const char *id, size_t index, int32_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const int32_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_int64; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Int64; } static void read_value(attribute_reader &reader, const char *id, size_t index, int64_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const int64_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_uint8; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::UInt8; } static void read_value(attribute_reader &reader, const char *id, size_t index, uint8_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const uint8_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_uint16; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::UInt16; } static void read_value(attribute_reader &reader, const char *id, size_t index, uint16_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const uint16_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_uint32; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::UInt32; } static void read_value(attribute_reader &reader, const char *id, size_t index, uint32_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const uint32_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_uint64; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::UInt64; } static void read_value(attribute_reader &reader, const char *id, size_t index, uint64_t &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const uint64_t &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_bool; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Boolean; } static void read_value(attribute_reader &reader, const char *id, size_t index, bool &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const bool &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_float; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Float; } static void read_value(attribute_reader &reader, const char *id, size_t index, float &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const float &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_double; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Double; } static void read_value(attribute_reader &reader, const char *id, size_t index, double &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, const double &value, size_t /*size*/ = 0); }; template <> struct data_type_traits { - static basic_type type(const std::size_t size) { return size == 0 ? basic_type::type_text : basic_type::type_varchar; } + static basic_type type(const std::size_t size) { return size == 0 ? basic_type::Text : basic_type::Varchar; } static void read_value(attribute_reader &reader, const char *id, size_t index, const char* value, size_t size); static void bind_value(attribute_writer &binder, size_t index, const char *value, size_t size = 0); }; template <> struct data_type_traits { - static basic_type type(const std::size_t size) { return size == 0 ? basic_type::type_text : basic_type::type_varchar; } + static basic_type type(const std::size_t size) { return size == 0 ? basic_type::Text : basic_type::Varchar; } static void read_value(attribute_reader &reader, const char *id, size_t index, char *value, size_t size); static void bind_value(attribute_writer &binder, size_t index, const char *value, size_t size = 0); }; template <> struct data_type_traits { - static basic_type type(const std::size_t size) { return size == 0 ? basic_type::type_text : basic_type::type_varchar; } + static basic_type type(const std::size_t size) { return size == 0 ? basic_type::Text : basic_type::Varchar; } template < int N > static void read_value(attribute_reader &reader, const char *id, const size_t index, char (&value)[N], const size_t size) { data_type_traits::read_value(reader, id, index, value, size); @@ -123,14 +123,14 @@ template <> struct data_type_traits template <> struct data_type_traits { - static basic_type type(const std::size_t size) { return size == 0 ? basic_type::type_text : basic_type::type_varchar; } + static basic_type type(const std::size_t size) { return size == 0 ? basic_type::Text : basic_type::Varchar; } static void read_value(attribute_reader &reader, const char *id, size_t index, std::string &value, size_t size); static void bind_value(attribute_writer &binder, size_t index, std::string &value, size_t size = 0); }; template <> struct data_type_traits { - static basic_type type(std::size_t /*size*/) { return basic_type::type_blob; } + static basic_type type(std::size_t /*size*/) { return basic_type::Blob; } static void read_value(attribute_reader &reader, const char *id, size_t index, utils::blob &value, size_t /*size*/ = 0); static void bind_value(attribute_writer &binder, size_t index, utils::blob &value, size_t /*size*/ = 0); }; @@ -152,7 +152,7 @@ template <> struct data_type_traits template < typename EnumType > struct data_type_traits>> { - static basic_type type(std::size_t /*size*/ = 0) { return basic_type::type_int32; } + static basic_type type(std::size_t /*size*/ = 0) { return basic_type::Int32; } static void read_value(attribute_reader &reader, const char *id, const size_t index, EnumType &value, const size_t size = 0) { data_type_traits::read_value(reader, id, index, reinterpret_cast(value), size); } diff --git a/include/matador/utils/identifier.hpp b/include/matador/utils/identifier.hpp index 0847e6c..86a2562 100644 --- a/include/matador/utils/identifier.hpp +++ b/include/matador/utils/identifier.hpp @@ -89,7 +89,7 @@ private: [[nodiscard]] virtual size_t hash() const = 0; std::type_index type_index_; - basic_type type_{basic_type::type_null}; + basic_type type_{basic_type::Null}; }; template diff --git a/include/matador/utils/value.hpp b/include/matador/utils/value.hpp index 1a62115..294d20e 100644 --- a/include/matador/utils/value.hpp +++ b/include/matador/utils/value.hpp @@ -80,7 +80,7 @@ public: private: utils::database_type value_; size_t size_{}; - basic_type type_{basic_type::type_null}; + basic_type type_{basic_type::Null}; }; diff --git a/source/core/object/attribute.cpp b/source/core/object/attribute.cpp index d762cf4..ce9f2b1 100644 --- a/source/core/object/attribute.cpp +++ b/source/core/object/attribute.cpp @@ -6,7 +6,7 @@ namespace matador::object { attribute::attribute(std::string name) -: attribute(std::move(name), utils::basic_type::type_null, {}, null_option_type::NotNull) { +: attribute(std::move(name), utils::basic_type::Null, {}, null_option_type::NotNull) { } attribute::attribute(std::string name, @@ -57,39 +57,39 @@ void attribute::change_type(const utils::basic_type type, const utils::field_att } bool attribute::is_integer() const { - return type_ >= utils::basic_type::type_int8 && type_ <= utils::basic_type::type_uint64; + return type_ >= utils::basic_type::Int8 && type_ <= utils::basic_type::UInt64; } bool attribute::is_floating_point() const { - return type_ == utils::basic_type::type_float || type_ == utils::basic_type::type_double; + return type_ == utils::basic_type::Float || type_ == utils::basic_type::Double; } bool attribute::is_bool() const { - return type_ == utils::basic_type::type_bool; + return type_ == utils::basic_type::Boolean; } bool attribute::is_string() const { - return type_ == utils::basic_type::type_text; + return type_ == utils::basic_type::Text; } bool attribute::is_varchar() const { - return type_ == utils::basic_type::type_varchar; + return type_ == utils::basic_type::Varchar; } bool attribute::is_date() const { - return type_ == utils::basic_type::type_date; + return type_ == utils::basic_type::Date; } bool attribute::is_time() const { - return type_ == utils::basic_type::type_time; + return type_ == utils::basic_type::Time; } bool attribute::is_blob() const { - return type_ == utils::basic_type::type_blob; + return type_ == utils::basic_type::Blob; } bool attribute::is_null() const { - return type_ == utils::basic_type::type_null; + return type_ == utils::basic_type::Null; } std::ostream & operator<<(std::ostream &os, const attribute &attr) { diff --git a/source/core/utils/identifier.cpp b/source/core/utils/identifier.cpp index a0c6d8c..8a1521a 100644 --- a/source/core/utils/identifier.cpp +++ b/source/core/utils/identifier.cpp @@ -23,7 +23,7 @@ identifier::base::base(const std::type_index &ti, const basic_type type) {} identifier::null_pk::null_pk() - : base(std::type_index(typeid(null_type_t)), basic_type::type_null) + : base(std::type_index(typeid(null_type_t)), basic_type::Null) {} identifier::base* identifier::null_pk::copy() const @@ -134,31 +134,31 @@ size_t identifier::use_count() const } bool identifier::is_integer() const { - return id_->type_ >= basic_type::type_int8 && id_->type_ <= basic_type::type_uint64; + return id_->type_ >= basic_type::Int8 && id_->type_ <= basic_type::UInt64; } bool identifier::is_floating_point() const { - return id_->type_ == basic_type::type_float || id_->type_ == basic_type::type_double; + return id_->type_ == basic_type::Float || id_->type_ == basic_type::Double; } bool identifier::is_bool() const { - return id_->type_ == basic_type::type_bool; + return id_->type_ == basic_type::Boolean; } bool identifier::is_varchar() const { - return id_->type_ == basic_type::type_varchar; + return id_->type_ == basic_type::Varchar; } bool identifier::is_date() const { - return id_->type_ == basic_type::type_date; + return id_->type_ == basic_type::Date; } bool identifier::is_time() const { - return id_->type_ == basic_type::type_time; + return id_->type_ == basic_type::Time; } bool identifier::is_blob() const { - return id_->type_ == basic_type::type_blob; + return id_->type_ == basic_type::Blob; } bool identifier::is_null() const diff --git a/source/core/utils/types.cpp b/source/core/utils/types.cpp index f40f72c..d55276a 100644 --- a/source/core/utils/types.cpp +++ b/source/core/utils/types.cpp @@ -6,41 +6,41 @@ namespace matador::utils { void initialize_by_basic_type(const basic_type type, database_type &val) { switch (type) { - case basic_type::type_int8: + case basic_type::Int8: val.emplace(); break; - case basic_type::type_int16: + case basic_type::Int16: val.emplace(); break; - case basic_type::type_int32: + case basic_type::Int32: val.emplace(); break; - case basic_type::type_int64: + case basic_type::Int64: val.emplace(); break; - case basic_type::type_uint8: + case basic_type::UInt8: val.emplace(); break; - case basic_type::type_uint16: + case basic_type::UInt16: val.emplace(); break; - case basic_type::type_uint32: + case basic_type::UInt32: val.emplace(); break; - case basic_type::type_uint64: + case basic_type::UInt64: val.emplace(); break; - case basic_type::type_bool: + case basic_type::Boolean: val.emplace(); break; - case basic_type::type_float: + case basic_type::Float: val.emplace(); break; - case basic_type::type_double: + case basic_type::Double: val.emplace(); break; - case basic_type::type_varchar: - case basic_type::type_text: + case basic_type::Varchar: + case basic_type::Text: val.emplace(); break; // case basic_type::type_date: @@ -49,7 +49,7 @@ void initialize_by_basic_type(const basic_type type, database_type &val) // case basic_type::type_time: // val.emplace