aboutsummaryrefslogtreecommitdiff
path: root/odb/qt/date-time/sqlite
diff options
context:
space:
mode:
Diffstat (limited to 'odb/qt/date-time/sqlite')
-rw-r--r--odb/qt/date-time/sqlite/default-mapping.hxx1
-rw-r--r--odb/qt/date-time/sqlite/qdate-time-traits.hxx17
-rw-r--r--odb/qt/date-time/sqlite/qdate-traits.hxx21
-rw-r--r--odb/qt/date-time/sqlite/qtime-traits.hxx1
4 files changed, 32 insertions, 8 deletions
diff --git a/odb/qt/date-time/sqlite/default-mapping.hxx b/odb/qt/date-time/sqlite/default-mapping.hxx
index 03e146c..a150ca9 100644
--- a/odb/qt/date-time/sqlite/default-mapping.hxx
+++ b/odb/qt/date-time/sqlite/default-mapping.hxx
@@ -1,5 +1,4 @@
// file : odb/qt/date-time/sqlite/default-mapping.hxx
-// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_QT_DATE_TIME_SQLITE_DEFAULT_MAPPING_HXX
diff --git a/odb/qt/date-time/sqlite/qdate-time-traits.hxx b/odb/qt/date-time/sqlite/qdate-time-traits.hxx
index 2c08b29..db561fc 100644
--- a/odb/qt/date-time/sqlite/qdate-time-traits.hxx
+++ b/odb/qt/date-time/sqlite/qdate-time-traits.hxx
@@ -1,5 +1,4 @@
// file : odb/qt/date-time/sqlite/qdatetime-traits.hxx
-// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_QT_DATE_TIME_SQLITE_QDATETIME_TRAITS_HXX
@@ -11,6 +10,8 @@
#include <cstddef> // std::size_t
#include <cstring> // std::memcpy
+#include <QtCore/QtGlobal> // QT_VERSION
+
#include <QtCore/QDateTime>
#include <odb/details/buffer.hxx>
@@ -91,7 +92,14 @@ namespace odb
else
{
v.setTimeSpec (Qt::UTC);
- v.setTime_t (static_cast <uint> (i));
+
+ // *Time_t() functions are deprecated in favor of *SecsSinceEpoch().
+ //
+#if QT_VERSION < 0x060000
+ v.setTime_t (static_cast<uint> (i));
+#else
+ v.setSecsSinceEpoch (static_cast<qint64> (i));
+#endif
}
}
@@ -107,7 +115,12 @@ namespace odb
else
{
is_null = false;
+
+#if QT_VERSION < 0x060000
i = static_cast<long long> (v.toTime_t ());
+#else
+ i = static_cast<long long> (v.toSecsSinceEpoch ());
+#endif
}
}
};
diff --git a/odb/qt/date-time/sqlite/qdate-traits.hxx b/odb/qt/date-time/sqlite/qdate-traits.hxx
index 825ce1b..52721b7 100644
--- a/odb/qt/date-time/sqlite/qdate-traits.hxx
+++ b/odb/qt/date-time/sqlite/qdate-traits.hxx
@@ -1,5 +1,4 @@
// file : odb/qt/date-time/sqlite/qdate-traits.hxx
-// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_QT_DATE_TIME_SQLITE_QDATE_TRAITS_HXX
@@ -11,7 +10,10 @@
#include <cstddef> // std::size_t
#include <cstring> // std::memcpy
+#include <QtCore/QtGlobal> // QT_VERSION
+
#include <QtCore/QDate>
+#include <QtCore/QDateTime>
#include <odb/details/buffer.hxx>
#include <odb/sqlite/traits.hxx>
@@ -93,8 +95,14 @@ namespace odb
{
QDateTime dt;
dt.setTimeSpec (Qt::UTC);
- dt.setTime_t (static_cast<uint> (i));
+ // *Time_t() functions are deprecated in favor of *SecsSinceEpoch().
+ //
+#if QT_VERSION < 0x060000
+ dt.setTime_t (static_cast<uint> (i));
+#else
+ dt.setSecsSinceEpoch (static_cast<qint64> (i));
+#endif
v = dt.date ();
}
}
@@ -109,8 +117,13 @@ namespace odb
else
{
is_null = false;
- i = static_cast<long long> (
- QDateTime (v, QTime (0, 0, 0), Qt::UTC).toTime_t ());
+ const QDateTime dt (v, QTime (0, 0, 0), Qt::UTC);
+
+#if QT_VERSION < 0x060000
+ i = static_cast<long long> (dt.toTime_t ());
+#else
+ i = static_cast<long long> (dt.toSecsSinceEpoch ());
+#endif
}
}
};
diff --git a/odb/qt/date-time/sqlite/qtime-traits.hxx b/odb/qt/date-time/sqlite/qtime-traits.hxx
index 8b57abd..dd86399 100644
--- a/odb/qt/date-time/sqlite/qtime-traits.hxx
+++ b/odb/qt/date-time/sqlite/qtime-traits.hxx
@@ -1,5 +1,4 @@
// file : odb/qt/date-time/sqlite/qtime-traits.hxx
-// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_QT_DATE_TIME_SQLITE_QTIME_TRAITS_HXX