aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-05-31 16:35:34 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-05-31 16:35:34 +0200
commited9c9d656b22ae7db9a325137d554274d11237b6 (patch)
treea9a70ba8640341940c2679c8e4ea1e95bf782656
parent9396bf3760e72fd03974de6d8b8aa72bdf53325e (diff)
Complete traits
-rw-r--r--odb/pgsql/traits.hxx65
1 files changed, 54 insertions, 11 deletions
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<id_boolean> {typedef bool image_type;};
+
+ template <>
struct image_traits<id_smallint> {typedef short image_type;};
template <>
@@ -64,6 +77,26 @@ namespace odb
template <>
struct image_traits<id_double> {typedef double image_type;};
+ template <>
+ struct image_traits<id_string> {typedef details::buffer image_type;};
+
+ template <>
+ struct image_traits<id_bytea> {typedef details::buffer image_type;};
+
+ template <>
+ struct image_traits<id_bit> {typedef unsigned char* image_type;};
+
+ template <>
+ struct image_traits<id_varbit> {typedef details::ubuffer image_type;};
+
+ template <>
+ struct image_traits<id_enum> {typedef details::buffer image_type;};
+
+ // @@ UUID image is a 16-byte sequence.
+ //
+ template <>
+ struct image_traits<id_uuid> {typedef unsigned char* image_type;};
+
//
// value_traits
//
@@ -140,6 +173,12 @@ namespace odb
{
};
+ template <>
+ struct LIBODB_PGSQL_EXPORT default_value_traits<std::string, id_enum>:
+ 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<const char*, id_enum>:
+ 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<unsigned long long>
- // {
- // static const database_type_id db_type_id = id_ulonglong;
- // };
+ template <>
+ struct default_type_traits<unsigned long long>
+ {
+ static const database_type_id db_type_id = id_bigint;
+ };
// Float types.
//