From 9e2f9ffa375d1013e481e6b399941fdb8bd32ffa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 23 Sep 2010 09:07:28 +0200 Subject: Move default traits implementation to default_value_traits This way traits for any type can be specialized. --- odb/mysql/traits.hxx | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/odb/mysql/traits.hxx b/odb/mysql/traits.hxx index e823eda..41a754f 100644 --- a/odb/mysql/traits.hxx +++ b/odb/mysql/traits.hxx @@ -53,8 +53,20 @@ namespace odb id_set }; + // + // value_traits + // + template - class value_traits + struct default_value_traits; + + template + class value_traits: public default_value_traits + { + }; + + template + class default_value_traits { public: typedef T value_type; @@ -107,25 +119,25 @@ namespace odb }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< std::string, details::buffer, id_string>: public string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< std::string, details::buffer, id_decimal>: public string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< std::string, details::buffer, id_enum>: public string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< std::string, details::buffer, id_set>: public string_value_traits { }; @@ -151,25 +163,25 @@ namespace odb }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< const char*, details::buffer, id_string>: public c_string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< const char*, details::buffer, id_decimal>: public c_string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< const char*, details::buffer, id_enum>: public c_string_value_traits { }; template <> - class LIBODB_MYSQL_EXPORT value_traits< + class LIBODB_MYSQL_EXPORT default_value_traits< const char*, details::buffer, id_set>: public c_string_value_traits { }; @@ -182,11 +194,8 @@ namespace odb struct default_type_traits; template - class type_traits + class type_traits: public default_type_traits { - public: - static const database_type_id db_type_id = - default_type_traits::db_type_id; }; // Integral types. -- cgit v1.1