aboutsummaryrefslogtreecommitdiff
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
parent05c106fa3f7fbb66b9cb6209bf76479ba6a5f21e (diff)
Add support for DATE, TIME and TIMESTAMP PostgreSQL types
-rw-r--r--odb/relational/pgsql/common.cxx11
-rw-r--r--odb/relational/pgsql/source.cxx40
2 files changed, 31 insertions, 20 deletions
diff --git a/odb/relational/pgsql/common.cxx b/odb/relational/pgsql/common.cxx
index 4a22d46..c5e3c9f 100644
--- a/odb/relational/pgsql/common.cxx
+++ b/odb/relational/pgsql/common.cxx
@@ -174,6 +174,13 @@ namespace relational
"float",
"double"
};
+
+ const char* date_time_types[] =
+ {
+ "int",
+ "long long",
+ "long long"
+ };
}
member_image_type::
@@ -217,9 +224,9 @@ namespace relational
}
void member_image_type::
- traverse_date_time (member_info&)
+ traverse_date_time (member_info& mi)
{
- type_ = "details::buffer";
+ type_ = date_time_types[mi.st->type - sql_type::DATE];
}
void member_image_type::
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