From 5e98aad4b067ece803b75cae7f538565da8661c8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 27 Jun 2012 14:55:47 +0200 Subject: Add support for mapping posix_time::ptime and QDateTime to DATE Oracle type --- boost/oracle/date-time/driver.cxx | 4 ++++ boost/oracle/date-time/test.hxx | 3 +++ qt/oracle/date-time/driver.cxx | 1 + qt/oracle/date-time/test.hxx | 4 ++++ 4 files changed, 12 insertions(+) diff --git a/boost/oracle/date-time/driver.cxx b/boost/oracle/date-time/driver.cxx index ca59757..a1a12fb 100644 --- a/boost/oracle/date-time/driver.cxx +++ b/boost/oracle/date-time/driver.cxx @@ -53,6 +53,10 @@ main (int argc, char* argv[]) o.times.push_back (min_date_time); o.times.push_back (ptime (max_date_time)); + o.times_d.push_back (ptime (date (2012, 6, 27), + time_duration (14, 17, 05, 0))); + o.times_d.push_back (not_a_date_time); + o.durations.push_back (time_duration (1, 2, 3, 123456)); o.durations.push_back (time_duration (-1, 2, 3)); o.durations.push_back (not_a_date_time); diff --git a/boost/oracle/date-time/test.hxx b/boost/oracle/date-time/test.hxx index 9699c5d..e7afe8f 100644 --- a/boost/oracle/date-time/test.hxx +++ b/boost/oracle/date-time/test.hxx @@ -26,6 +26,7 @@ struct object id == x.id && dates == x.dates && times == x.times && + times_d == x.times_d && durations == x.durations; } @@ -34,6 +35,8 @@ struct object std::vector dates; std::vector times; + #pragma db value_type("DATE") + std::vector times_d; std::vector durations; }; diff --git a/qt/oracle/date-time/driver.cxx b/qt/oracle/date-time/driver.cxx index 5b3b51a..20fe9db 100644 --- a/qt/oracle/date-time/driver.cxx +++ b/qt/oracle/date-time/driver.cxx @@ -56,6 +56,7 @@ main (int argc, char* argv[]) o.date = t.date (); o.date_time = t; + o.date_time_d = QDateTime (QDate (2012, 6, 27), QTime (14, 17, 05, 0)); o.time = t.time (); { diff --git a/qt/oracle/date-time/test.hxx b/qt/oracle/date-time/test.hxx index 2eb8735..45ccfd9 100644 --- a/qt/oracle/date-time/test.hxx +++ b/qt/oracle/date-time/test.hxx @@ -19,6 +19,7 @@ struct object id == x.id && date == x.date && date_time == x.date_time && + date_time_d == x.date_time_d && time == x.time; } @@ -28,6 +29,7 @@ struct object return date.isNull () && date_time.isNull () && + date_time_d.isNull () && time.isNull (); } @@ -36,6 +38,8 @@ struct object QDate date; QDateTime date_time; + #pragma db type("DATE") + QDateTime date_time_d; QTime time; }; -- cgit v1.1