From ed9c9d656b22ae7db9a325137d554274d11237b6 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Tue, 31 May 2011 16:35:34 +0200 Subject: Complete traits --- odb/pgsql/traits.hxx | 65 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 11 deletions(-) (limited to 'odb') diff --git a/odb/pgsql/traits.hxx b/odb/pgsql/traits.hxx index 62a6df2..847f13e 100644 --- a/odb/pgsql/traits.hxx +++ b/odb/pgsql/traits.hxx @@ -30,13 +30,23 @@ namespace odb id_smallint, id_integer, id_bigint, + id_numeric, + id_real, id_double, - id_serial, - id_bigserial, - id_string + id_date, + id_time, + id_timestamp, + + id_string, + id_bytea, + id_bit, + id_varbit, + id_enum, + + id_uuid }; // @@ -47,6 +57,9 @@ namespace odb struct image_traits; template <> + struct image_traits {typedef bool image_type;}; + + template <> struct image_traits {typedef short image_type;}; template <> @@ -64,6 +77,26 @@ namespace odb template <> struct image_traits {typedef double image_type;}; + template <> + struct image_traits {typedef details::buffer image_type;}; + + template <> + struct image_traits {typedef details::buffer image_type;}; + + template <> + struct image_traits {typedef unsigned char* image_type;}; + + template <> + struct image_traits {typedef details::ubuffer image_type;}; + + template <> + struct image_traits {typedef details::buffer image_type;}; + + // @@ UUID image is a 16-byte sequence. + // + template <> + struct image_traits {typedef unsigned char* image_type;}; + // // value_traits // @@ -140,6 +173,12 @@ namespace odb { }; + template <> + struct LIBODB_PGSQL_EXPORT default_value_traits: + string_value_traits + { + }; + // const char* specialization // // Specialization for const char* which only supports initialization @@ -172,6 +211,12 @@ namespace odb { }; + template <> + struct LIBODB_PGSQL_EXPORT default_value_traits: + c_string_value_traits + { + }; + // // type_traits // @@ -246,15 +291,13 @@ namespace odb static const database_type_id db_type_id = id_bigint; }; - // @@ No representation for an unsigned 64 bit value. - // Should we force a compile time error with a message - // or just truncate? + // @@ Type stored as a signed 8-byte integer in the database. // - // template <> - // struct default_type_traits - // { - // static const database_type_id db_type_id = id_ulonglong; - // }; + template <> + struct default_type_traits + { + static const database_type_id db_type_id = id_bigint; + }; // Float types. // -- cgit v1.1