aboutsummaryrefslogtreecommitdiff
path: root/qt/mssql/date-time
diff options
context:
space:
mode:
Diffstat (limited to 'qt/mssql/date-time')
-rw-r--r--qt/mssql/date-time/driver.cxx4
-rw-r--r--qt/mssql/date-time/test.hxx61
2 files changed, 42 insertions, 23 deletions
diff --git a/qt/mssql/date-time/driver.cxx b/qt/mssql/date-time/driver.cxx
index 66d6b67..0e7681a 100644
--- a/qt/mssql/date-time/driver.cxx
+++ b/qt/mssql/date-time/driver.cxx
@@ -53,10 +53,12 @@ main (int argc, char* argv[])
// Check persistence of valid dates and times.
//
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
QDateTime t (QDateTime::currentDateTime ());
o.date = t.date ();
o.date_time = t;
+#endif
// In DATETIME fractional seconds are rounded to .000, .003, or .007.
//
@@ -68,7 +70,9 @@ main (int argc, char* argv[])
o.date_time_sdt = QDateTime (QDate (2012, 1, 14),
QTime (11, 57, 0, 0));
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
o.time = t.time ();
+#endif
{
transaction t (db->begin ());
diff --git a/qt/mssql/date-time/test.hxx b/qt/mssql/date-time/test.hxx
index c494efb..218baaa 100644
--- a/qt/mssql/date-time/test.hxx
+++ b/qt/mssql/date-time/test.hxx
@@ -13,35 +13,14 @@
#pragma db object
struct object
{
- bool
- operator== (const object& x) const
- {
- return
- id == x.id &&
- date == x.date &&
- date_time == x.date_time &&
- date_time_dt == x.date_time_dt &&
- date_time_sdt == x.date_time_sdt &&
- time == x.time;
- }
-
- bool
- is_null () const
- {
- return
- date.isNull () &&
- date_time.isNull () &&
- date_time_dt.isNull () &&
- date_time_sdt.isNull () &&
- time.isNull ();
- }
-
#pragma db id auto
unsigned long id;
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
QDate date;
QDateTime date_time;
+#endif
#pragma db type ("DATETIME")
QDateTime date_time_dt;
@@ -49,7 +28,43 @@ struct object
#pragma db type ("SMALLDATETIME")
QDateTime date_time_sdt;
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
QTime time;
+#endif
+
+ bool
+ operator== (const object& x) const
+ {
+ return
+ id == x.id
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && date == x.date
+ && date_time == x.date_time
+#endif
+ && date_time_dt == x.date_time_dt
+ && date_time_sdt == x.date_time_sdt
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && time == x.time
+#endif
+ ;
+ }
+
+ bool
+ is_null () const
+ {
+ return
+ true
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && date.isNull ()
+ && date_time.isNull ()
+#endif
+ && date_time_dt.isNull ()
+ && date_time_sdt.isNull ()
+#if !defined(MSSQL_SERVER_VERSION) || MSSQL_SERVER_VERSION >= 1000
+ && time.isNull ()
+#endif
+ ;
+ }
};
#endif // TEST_HXX