summaryrefslogtreecommitdiff
path: root/odb/relational/pgsql/source.cxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-07-13 10:04:57 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-07-13 10:04:57 +0200
commitb5bc00cd10475d831de1952086c08fcbcb57dbb6 (patch)
treeddb5ad25f665e0631d562ea9999607493c7b6d0e /odb/relational/pgsql/source.cxx
parent05c106fa3f7fbb66b9cb6209bf76479ba6a5f21e (diff)
Add support for DATE, TIME and TIMESTAMP PostgreSQL types
Diffstat (limited to 'odb/relational/pgsql/source.cxx')
-rw-r--r--odb/relational/pgsql/source.cxx40
1 files changed, 22 insertions, 18 deletions
diff --git a/odb/relational/pgsql/source.cxx b/odb/relational/pgsql/source.cxx
index 89531f3..6aaf930 100644
--- a/odb/relational/pgsql/source.cxx
+++ b/odb/relational/pgsql/source.cxx
@@ -73,6 +73,13 @@ namespace relational
"pgsql::bind::bytea", // BYTEA
};
+ const char* date_time_buffer_types[] =
+ {
+ "pgsql::bind::date",
+ "pgsql::bind::time",
+ "pgsql::bind::timestamp"
+ };
+
const char* oids[] =
{
"pgsql::bool_oid", // BOOLEAN
@@ -93,13 +100,6 @@ namespace relational
"pgsql::varbit_oid", // VARBIT
"pgsql::uuid_oid" // UUID
};
-
- // @@ Complete once date-time format is known.
- //
-
- // const char* date_time_buffer_types[] =
- // {
- // };
}
struct statement_oids: object_columns_base, context
@@ -208,10 +208,12 @@ namespace relational
}
virtual void
- traverse_date_time (member_info&)
+ traverse_date_time (member_info& mi)
{
- // @@ Complete once date-time format is known.
- //
+ os << b << ".type = " <<
+ date_time_buffer_types[mi.st->type - sql_type::DATE] << ";"
+ << b << ".buffer = &" << arg << "." << mi.var << "value;"
+ << b << ".is_null = &" << arg << "." << mi.var << "null;";
}
virtual void
@@ -339,8 +341,8 @@ namespace relational
virtual void
traverse_date_time (member_info&)
{
- // @@ Complete once date-time format is known.
- //
+ os << e << " = 0;"
+ << endl;
}
virtual void
@@ -551,10 +553,10 @@ namespace relational
}
virtual void
- traverse_date_time (member_info&)
+ traverse_date_time (member_info& mi)
{
- // @@ Complete once date-time format is known.
- //
+ os << traits << "::set_image (" << endl
+ << "i." << mi.var << "value, is_null, " << member << ");";
}
virtual void
@@ -767,10 +769,12 @@ namespace relational
}
virtual void
- traverse_date_time (member_info&)
+ traverse_date_time (member_info& mi)
{
- // @@ Complete once date-time format is known.
- //
+ os << traits << "::set_value (" << endl
+ << member << ", i." << mi.var << "value, " <<
+ "i." << mi.var << "null);"
+ << endl;
}
virtual void