diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-03-25 17:45:43 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-03-25 17:45:43 +0200 |
commit | 8ffecc252dba12e7208ea25c654e198151217dd7 (patch) | |
tree | 3a428acb8b9c75328ea755452800b32b1a22a72b | |
parent | fda5cb404d7dcb926233f8b27e920e44f4e56635 (diff) |
Add --hxx-prologue to qt options for new traits
-rw-r--r-- | odb/qt.options | 3 | ||||
-rw-r--r-- | odb/qt/mysql/qdatetime-traits.hxx | 19 |
2 files changed, 13 insertions, 9 deletions
diff --git a/odb/qt.options b/odb/qt.options index bafd94e..bb51aab 100644 --- a/odb/qt.options +++ b/odb/qt.options @@ -7,3 +7,6 @@ --odb-epilogue '#include <odb/qt/mysql/default-mapping.hxx>' --hxx-prologue '#include <odb/qt/mysql/qstring-traits.hxx>' +--hxx-prologue '#include <odb/qt/mysql/qdate-traits.hxx>' +--hxx-prologue '#include <odb/qt/mysql/qtime-traits.hxx>' +--hxx-prologue '#include <odb/qt/mysql/qdatetime-traits.hxx>'
\ No newline at end of file diff --git a/odb/qt/mysql/qdatetime-traits.hxx b/odb/qt/mysql/qdatetime-traits.hxx index 2ed8139..75cb05e 100644 --- a/odb/qt/mysql/qdatetime-traits.hxx +++ b/odb/qt/mysql/qdatetime-traits.hxx @@ -41,16 +41,16 @@ namespace odb static void set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v) { - if (v.is_null ()) + if (v.isNull ()) is_null = true; else { is_null = false; const QDate& d (v.date ()); - i.year = d.year; - i.month = d.month; - i.day = d.day; + i.year = d.year (); + i.month = d.month (); + i.day = d.day (); const QTime& t (v.time ()); i.hour = t.hour (); @@ -60,6 +60,7 @@ namespace odb } }; + template <> class default_value_traits<QDateTime, MYSQL_TIME, id_timestamp> { public: @@ -77,23 +78,23 @@ namespace odb else { v.setDate (QDate (i.year, i.month, i.day)); - v.setDate (QTime (i.hour, i.minute, i.second)); + v.setTime (QTime (i.hour, i.minute, i.second)); } } static void set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v) { - if (v.is_null ()) + if (v.isNull ()) is_null = true; else { is_null = false; const QDate& d (v.date ()); - i.year = d.year; - i.month = d.month; - i.day = d.day; + i.year = d.year (); + i.month = d.month (); + i.day = d.day (); const QTime& t (v.time ()); i.hour = t.hour (); |