aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--odb/qt.options9
-rw-r--r--odb/qt/basic-mysql.options11
-rw-r--r--odb/qt/basic-sqlite.options11
-rw-r--r--odb/qt/basic/mysql/default-mapping.hxx24
-rw-r--r--odb/qt/basic/mysql/qbyte-array-traits.hxx (renamed from odb/qt/mysql/qbytearray-traits.hxx)26
-rw-r--r--odb/qt/basic/mysql/qstring-traits.hxx (renamed from odb/qt/mysql/qstring-traits.hxx)19
-rw-r--r--odb/qt/basic/sqlite/default-mapping.hxx22
-rw-r--r--odb/qt/basic/sqlite/qbyte-array-traits.hxx72
-rw-r--r--odb/qt/basic/sqlite/qstring-traits.hxx71
-rw-r--r--odb/qt/config.h.in62
-rw-r--r--odb/qt/date-time-mysql.options12
-rw-r--r--odb/qt/date-time-sqlite.options12
-rw-r--r--odb/qt/date-time/exceptions.cxx21
-rw-r--r--odb/qt/date-time/exceptions.hxx31
-rw-r--r--odb/qt/date-time/mysql/default-mapping.hxx28
-rw-r--r--odb/qt/date-time/mysql/qdate-time-traits.hxx127
-rw-r--r--odb/qt/date-time/mysql/qdate-traits.hxx68
-rw-r--r--odb/qt/date-time/mysql/qtime-traits.hxx69
-rw-r--r--odb/qt/date-time/sqlite/default-mapping.hxx28
-rw-r--r--odb/qt/date-time/sqlite/qdate-time-traits.hxx123
-rw-r--r--odb/qt/date-time/sqlite/qdate-traits.hxx126
-rw-r--r--odb/qt/date-time/sqlite/qtime-traits.hxx118
-rw-r--r--odb/qt/dummy.cxx14
-rw-r--r--odb/qt/dummy.hxx12
-rw-r--r--odb/qt/exception.hxx2
-rw-r--r--odb/qt/libodb-qt-vc10.vcxproj8
-rw-r--r--odb/qt/libodb-qt-vc9.vcproj8
-rw-r--r--odb/qt/makefile2
-rw-r--r--odb/qt/mysql/default-mapping.hxx30
-rw-r--r--odb/qt/mysql/qdate-traits.hxx55
-rw-r--r--odb/qt/mysql/qdatetime-traits.hxx109
-rw-r--r--odb/qt/mysql/qtime-traits.hxx55
-rw-r--r--odb/qt/version.hxx6
-rw-r--r--odb/qt/version.options2
-rw-r--r--version2
36 files changed, 1012 insertions, 385 deletions
diff --git a/README b/README
index 06ef2db..c19f0da 100644
--- a/README
+++ b/README
@@ -6,7 +6,7 @@ For more information see:
http://www.codesynthesis.com/products/odb/
-This package contains the Boost Qt profile library. The Qt profile provides
+This package contains the Qt profile library. The Qt profile provides
support for persisting Qt smart pointers, containers, and value types with
the ODB system.
diff --git a/odb/qt.options b/odb/qt.options
index bb51aab..76c25ec 100644
--- a/odb/qt.options
+++ b/odb/qt.options
@@ -3,10 +3,5 @@
# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
# license : GNU GPL v2; see accompanying LICENSE file
---profile qt/version
-
---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
+--profile qt/basic
+--profile qt/date-time
diff --git a/odb/qt/basic-mysql.options b/odb/qt/basic-mysql.options
new file mode 100644
index 0000000..adb3529
--- /dev/null
+++ b/odb/qt/basic-mysql.options
@@ -0,0 +1,11 @@
+# file : odb/qt/basic-mysql.options
+# author : Constantin Michael <constantin@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile qt/version
+
+--odb-epilogue '#include <odb/qt/basic/mysql/default-mapping.hxx>'
+
+--hxx-prologue '#include <odb/qt/basic/mysql/qstring-traits.hxx>'
+--hxx-prologue '#include <odb/qt/basic/mysql/qbyte-array-traits.hxx>'
diff --git a/odb/qt/basic-sqlite.options b/odb/qt/basic-sqlite.options
new file mode 100644
index 0000000..4a5a082
--- /dev/null
+++ b/odb/qt/basic-sqlite.options
@@ -0,0 +1,11 @@
+# file : odb/qt/basic-sqlite.options
+# author : Constantin Michael <constantin@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile qt/version
+
+--odb-epilogue '#include <odb/qt/basic/sqlite/default-mapping.hxx>'
+
+--hxx-prologue '#include <odb/qt/basic/sqlite/qstring-traits.hxx>'
+--hxx-prologue '#include <odb/qt/basic/sqlite/qbyte-array-traits.hxx>'
diff --git a/odb/qt/basic/mysql/default-mapping.hxx b/odb/qt/basic/mysql/default-mapping.hxx
new file mode 100644
index 0000000..de73007
--- /dev/null
+++ b/odb/qt/basic/mysql/default-mapping.hxx
@@ -0,0 +1,24 @@
+// file : odb/qt/basic/mysql/default-mapping.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX
+#define ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX
+
+#include <QString>
+#include <QByteArray>
+
+// Map QString to MySQL VARCHAR (56) by default.
+//
+// @@ Temporary mapping until a solution for specifying primary key type
+// has been implemented.
+//
+#pragma db value(QString) type("VARCHAR(56) NOT NULL")
+
+// Map QByteArray to MySQL BLOB by default. Allow NULL values by default as
+// QByteArray provides a null representation.
+//
+#pragma db value(QByteArray) type("BLOB")
+
+#endif // ODB_QT_BASIC_MYSQL_DEFAULT_MAPPING_HXX
diff --git a/odb/qt/mysql/qbytearray-traits.hxx b/odb/qt/basic/mysql/qbyte-array-traits.hxx
index d94bf44..f0239fd 100644
--- a/odb/qt/mysql/qbytearray-traits.hxx
+++ b/odb/qt/basic/mysql/qbyte-array-traits.hxx
@@ -1,10 +1,10 @@
-// file : odb/qt/mysql/qbytearray-traits.hxx
+// file : odb/qt/basic/mysql/qbyte-array-traits.hxx
// author : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef ODB_QT_MYSQL_QBYTEARRAY_TRAITS_HXX
-#define ODB_QT_MYSQL_QBYTEARRAY_TRAITS_HXX
+#ifndef ODB_QT_BASIC_MYSQL_QBYTE_ARRAY_TRAITS_HXX
+#define ODB_QT_BASIC_MYSQL_QBYTE_ARRAY_TRAITS_HXX
#include <odb/pre.hxx>
@@ -37,13 +37,7 @@ namespace odb
if (is_null)
v = QByteArray ();
else
- {
- if (v.capacity () < n + 1)
- v.reserve (n + 1);
-
- std::memcpy (v.data (), b.data (), n);
- v.resize (n);
- }
+ v.replace (0, v.size (), b.data (), static_cast<int> (n));
}
static void
@@ -52,20 +46,22 @@ namespace odb
bool& is_null,
const QByteArray& v)
{
- if (v.is_null)
+ if (v.isNull ())
is_null = true;
else
{
- n = v.size ();
+ is_null = false;
+
+ n = static_cast<std::size_t> (v.size ());
+
if (n > b.capacity ())
b.capacity (n);
- if (n != 0)
- std::memcpy (v.data (), b.data (), n);
+ std::memcpy (b.data (), v.data (), n);
}
}
};
}
}
-#endif // ODB_QT_MYSQL_QBYTEARRAY_TRAITS_HXX
+#endif // ODB_QT_BASIC_MYSQL_QBYTE_ARRAY_TRAITS_HXX
diff --git a/odb/qt/mysql/qstring-traits.hxx b/odb/qt/basic/mysql/qstring-traits.hxx
index facb569..0ea8e86 100644
--- a/odb/qt/mysql/qstring-traits.hxx
+++ b/odb/qt/basic/mysql/qstring-traits.hxx
@@ -1,10 +1,10 @@
-// file : odb/qt/mysql/qstring-traits.hxx
+// file : odb/qt/basic/mysql/qstring-traits.hxx
// author : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
-#ifndef ODB_QT_MYSQL_QSTRING_TRAITS_HXX
-#define ODB_QT_MYSQL_QSTRING_TRAITS_HXX
+#ifndef ODB_QT_BASIC_MYSQL_QSTRING_TRAITS_HXX
+#define ODB_QT_BASIC_MYSQL_QSTRING_TRAITS_HXX
#include <odb/pre.hxx>
@@ -33,10 +33,10 @@ namespace odb
std::size_t n,
bool is_null)
{
- if (!is_null)
- v = QString::fromUtf8 (b.data (), n);
+ if (is_null)
+ v = QString ();
else
- v.clear ();
+ v = QString::fromUtf8 (b.data (), static_cast<int> (n));
}
static void
@@ -48,13 +48,12 @@ namespace odb
is_null = false;
const QByteArray& a (v.toUtf8 ());
- n = a.size ();
+ n = static_cast<std::size_t> (a.size ());
if (n > b.capacity ())
b.capacity (n);
- if (n != 0)
- std::memcpy (b.data (), a.data (), n);
+ std::memcpy (b.data (), a.data (), n);
}
};
@@ -92,4 +91,4 @@ namespace odb
#include <odb/post.hxx>
-#endif // ODB_QT_MYSQL_QSTRING_TRAITS_HXX
+#endif // ODB_QT_BASIC_MYSQL_QSTRING_TRAITS_HXX
diff --git a/odb/qt/basic/sqlite/default-mapping.hxx b/odb/qt/basic/sqlite/default-mapping.hxx
new file mode 100644
index 0000000..ea8108e
--- /dev/null
+++ b/odb/qt/basic/sqlite/default-mapping.hxx
@@ -0,0 +1,22 @@
+// file : odb/qt/basic/sqlite/default-mapping.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_BASIC_SQLITE_DEFAULT_MAPPING_HXX
+#define ODB_QT_BASIC_SQLITE_DEFAULT_MAPPING_HXX
+
+#include <QString>
+#include <QByteArray>
+
+// Map QString to SQLite TEXT by default. Allow NULL values by default as
+// QString provides a null representation.
+//
+#pragma db value(QString) type("TEXT")
+
+// Map QByteArray to SQLite TEXT by default. Allow NULL values by default as
+// QByteArray provides a null representation.
+//
+#pragma db value(QByteArray) type("BLOB")
+
+#endif // ODB_QT_BASIC_SQLITE_DEFAULT_MAPPING_HXX
diff --git a/odb/qt/basic/sqlite/qbyte-array-traits.hxx b/odb/qt/basic/sqlite/qbyte-array-traits.hxx
new file mode 100644
index 0000000..5f30222
--- /dev/null
+++ b/odb/qt/basic/sqlite/qbyte-array-traits.hxx
@@ -0,0 +1,72 @@
+// file : odb/qt/basic/sqlite/qbyte-array-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_BASIC_SQLITE_QBYTE_ARRAY_TRAITS_HXX
+#define ODB_QT_BASIC_SQLITE_QBYTE_ARRAY_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <cstring> // std::memcpy
+#include <cstddef> // std::size_t
+
+#include <QByteArray>
+
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ class default_value_traits<QByteArray, details::buffer, id_blob>
+ {
+ public:
+ typedef QByteArray value_type;
+ typedef QByteArray query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (QByteArray& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = QByteArray ();
+ else
+ v.replace (0, v.size (), b.data (), static_cast<int> (n));
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const QByteArray& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+
+ n = static_cast<std::size_t> (v.size ());
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ std::memcpy (b.data (), v.data (), n);
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QByteArray>
+ {
+ static const database_type_id db_type_id = id_blob;
+ };
+ }
+}
+
+#endif // ODB_QT_BASIC_SQLITE_QBYTE_ARRAY_TRAITS_HXX
diff --git a/odb/qt/basic/sqlite/qstring-traits.hxx b/odb/qt/basic/sqlite/qstring-traits.hxx
new file mode 100644
index 0000000..31a9c1f
--- /dev/null
+++ b/odb/qt/basic/sqlite/qstring-traits.hxx
@@ -0,0 +1,71 @@
+// file : odb/qt/basic/sqlite/qstring-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_BASIC_SQLITE_QSTRING_TRAITS_HXX
+#define ODB_QT_BASIC_SQLITE_QSTRING_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <cstring> // std::memcpy
+#include <cstddef> // std::size_t
+
+#include <QString>
+
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ struct default_value_traits <QString, details::buffer, id_text>
+ {
+ public:
+ typedef QString value_type;
+ typedef QString query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (QString& v,
+ const details::buffer& b,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = QString ();
+ else
+ v = QString::fromUtf8 (b.data (), static_cast<int> (n));
+ }
+
+ static void
+ set_image (details::buffer& b,
+ std::size_t& n,
+ bool& is_null,
+ const QString& v)
+ {
+ is_null = false;
+
+ const QByteArray& a (v.toUtf8 ());
+ n = static_cast<std::size_t> (a.size ());
+
+ if (n > b.capacity ())
+ b.capacity (n);
+
+ std::memcpy (b.data (), a.data (), n);
+ }
+ };
+
+ template <>
+ struct default_type_traits<QString>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_BASIC_SQLITE_QSTRING_TRAITS_HXX
diff --git a/odb/qt/config.h.in b/odb/qt/config.h.in
deleted file mode 100644
index 4a1a204..0000000
--- a/odb/qt/config.h.in
+++ /dev/null
@@ -1,62 +0,0 @@
-/* odb/qt/config.h.in. Generated from configure.ac by autoheader. */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#undef HAVE_DLFCN_H
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#undef LT_OBJDIR
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
diff --git a/odb/qt/date-time-mysql.options b/odb/qt/date-time-mysql.options
new file mode 100644
index 0000000..02bebf7
--- /dev/null
+++ b/odb/qt/date-time-mysql.options
@@ -0,0 +1,12 @@
+# file : odb/qt/date-time-mysql.options
+# author : Constantin Michael <constantin@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile qt/version
+
+--odb-epilogue '#include <odb/qt/date-time/mysql/default-mapping.hxx>'
+
+--hxx-prologue '#include <odb/qt/date-time/mysql/qdate-traits.hxx>'
+--hxx-prologue '#include <odb/qt/date-time/mysql/qtime-traits.hxx>'
+--hxx-prologue '#include <odb/qt/date-time/mysql/qdate-time-traits.hxx>'
diff --git a/odb/qt/date-time-sqlite.options b/odb/qt/date-time-sqlite.options
new file mode 100644
index 0000000..c500499
--- /dev/null
+++ b/odb/qt/date-time-sqlite.options
@@ -0,0 +1,12 @@
+# file : odb/qt/date-time-sqlite.options
+# author : Constantin Michael <constantin@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile qt/version
+
+--odb-epilogue '#include <odb/qt/date-time/sqlite/default-mapping.hxx>'
+
+--hxx-prologue '#include <odb/qt/date-time/sqlite/qdate-traits.hxx>'
+--hxx-prologue '#include <odb/qt/date-time/sqlite/qtime-traits.hxx>'
+--hxx-prologue '#include <odb/qt/date-time/sqlite/qdate-time-traits.hxx>'
diff --git a/odb/qt/date-time/exceptions.cxx b/odb/qt/date-time/exceptions.cxx
new file mode 100644
index 0000000..b2ccffe
--- /dev/null
+++ b/odb/qt/date-time/exceptions.cxx
@@ -0,0 +1,21 @@
+// file : odb/qt/date-time/exceptions.cxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <odb/qt/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace qt
+ {
+ namespace date_time
+ {
+ const char* value_out_of_range::
+ what () const throw ()
+ {
+ return "date/time value out of range";
+ }
+ }
+ }
+}
diff --git a/odb/qt/date-time/exceptions.hxx b/odb/qt/date-time/exceptions.hxx
new file mode 100644
index 0000000..445b110
--- /dev/null
+++ b/odb/qt/date-time/exceptions.hxx
@@ -0,0 +1,31 @@
+// file : odb/qt/date-time/exceptions.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_EXCEPTIONS_HXX
+#define ODB_QT_DATE_TIME_EXCEPTIONS_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/qt/exception.hxx>
+#include <odb/qt/details/export.hxx>
+
+namespace odb
+{
+ namespace qt
+ {
+ namespace date_time
+ {
+ struct LIBODB_QT_EXPORT value_out_of_range: exception
+ {
+ virtual const char*
+ what () const throw ();
+ };
+ }
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_QT_DATE_TIME_EXCEPTIONS_HXX
diff --git a/odb/qt/date-time/mysql/default-mapping.hxx b/odb/qt/date-time/mysql/default-mapping.hxx
new file mode 100644
index 0000000..fa0b823
--- /dev/null
+++ b/odb/qt/date-time/mysql/default-mapping.hxx
@@ -0,0 +1,28 @@
+// file : odb/qt/date-time/mysql/default-mapping.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_MYSQL_DEFAULT_MAPPING_HXX
+#define ODB_QT_DATE_TIME_MYSQL_DEFAULT_MAPPING_HXX
+
+#include <QDate>
+#include <QTime>
+#include <QDateTime>
+
+// Map QDate to MySQL DATE by default. QDate provides a null
+// representation so allow NULL values by default.
+//
+#pragma db value(QDate) type("DATE")
+
+// Map QTime to MySQL TIME by default. QTime provides a null
+// representation so allow NULL values by default.
+//
+#pragma db value(QTime) type("TIME")
+
+// Map QDateTime to MySQL DATETIME by default. QDateTime provides a null
+// representation so allow NULL values by default.
+//
+#pragma db value(QDateTime) type("DATETIME")
+
+#endif // ODB_QT_DATE_TIME_MYSQL_DEFAULT_MAPPING_HXX
diff --git a/odb/qt/date-time/mysql/qdate-time-traits.hxx b/odb/qt/date-time/mysql/qdate-time-traits.hxx
new file mode 100644
index 0000000..9d212a3
--- /dev/null
+++ b/odb/qt/date-time/mysql/qdate-time-traits.hxx
@@ -0,0 +1,127 @@
+// file : odb/qt/date-time/mysql/qdate-time-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_MYSQL_QDATETIME_TRAITS_HXX
+#define ODB_QT_DATE_TIME_MYSQL_QDATETIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QDateTime>
+
+#include <odb/mysql/traits.hxx>
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ class default_value_traits<QDateTime, MYSQL_TIME, id_datetime>
+ {
+ public:
+ typedef QDateTime value_type;
+ typedef QDateTime query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (QDateTime& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ // Default constructor creates a null QDateTime.
+ //
+ v = QDateTime ();
+ else
+ v = QDateTime (QDate (static_cast<int> (i.year),
+ static_cast<int> (i.month),
+ static_cast<int> (i.day)),
+ QTime (static_cast<int> (i.hour),
+ static_cast<int> (i.minute),
+ static_cast<int> (i.second)));
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ if ((v < QDateTime (QDate (1000, 1, 1))) ||
+ (v >= QDateTime (QDate (10000, 1, 1))))
+ throw odb::qt::date_time::value_out_of_range ();
+
+ is_null = false;
+
+ const QDate& d (v.date ());
+ i.year = static_cast<unsigned int> (d.year ());
+ i.month = static_cast<unsigned int> (d.month ());
+ i.day = static_cast<unsigned int> (d.day ());
+
+ const QTime& t (v.time ());
+ i.hour = static_cast<unsigned int> (t.hour ());
+ i.minute = static_cast<unsigned int> (t.minute ());
+ i.second = static_cast<unsigned int> (t.second ());
+ }
+ }
+ };
+
+ template <>
+ class default_value_traits<QDateTime, MYSQL_TIME, id_timestamp>
+ {
+ public:
+ typedef QDateTime value_type;
+ typedef QDateTime query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (QDateTime& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ // Default constructor creates a null QDateTime.
+ //
+ v = QDateTime ();
+ else
+ v = QDateTime (QDate (static_cast<int> (i.year),
+ static_cast<int> (i.month),
+ static_cast<int> (i.day)),
+ QTime (static_cast<int> (i.hour),
+ static_cast<int> (i.minute),
+ static_cast<int> (i.second)));
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ if ((v <= QDateTime (QDate (1970, 1, 1))) ||
+ (v > QDateTime (QDate (2038, 1, 19), QTime (3, 14, 7))))
+ throw odb::qt::date_time::value_out_of_range ();
+
+ is_null = false;
+
+ const QDate& d (v.date ());
+ i.year = static_cast<unsigned int> (d.year ());
+ i.month = static_cast<unsigned int> (d.month ());
+ i.day = static_cast<unsigned int> (d.day ());
+
+ const QTime& t (v.time ());
+ i.hour = static_cast<unsigned int> (t.hour ());
+ i.minute = static_cast<unsigned int> (t.minute ());
+ i.second = static_cast<unsigned int> (t.second ());
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QDateTime>
+ {
+ static const database_type_id db_type_od = id_datetime;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_MYSQL_QDATETIME_TRAITS_HXX
diff --git a/odb/qt/date-time/mysql/qdate-traits.hxx b/odb/qt/date-time/mysql/qdate-traits.hxx
new file mode 100644
index 0000000..1034cbc
--- /dev/null
+++ b/odb/qt/date-time/mysql/qdate-traits.hxx
@@ -0,0 +1,68 @@
+// file : odb/qt/date-time/mysql/qdate-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_MYSQL_QDATE_TRAITS_HXX
+#define ODB_QT_DATE_TIME_MYSQL_QDATE_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QDate>
+
+#include <odb/mysql/traits.hxx>
+#include <odb/qt/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ class default_value_traits<QDate, MYSQL_TIME, id_date>
+ {
+ public:
+ typedef QDate value_type;
+ typedef QDate query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (QDate& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ // A null QDate value is equivalent to an invalid QDate value.
+ // Set v to an invalid date to represent null.
+ //
+ v.setDate (0, 0, 0);
+ else
+ v.setDate (static_cast<int> (i.year),
+ static_cast<int> (i.month),
+ static_cast<int> (i.day));
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const QDate& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else if ((v < QDate (1000, 1, 1)) || (v > QDate (9999, 12, 31)))
+ throw odb::qt::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+
+ i.year = static_cast<unsigned int> (v.year ());
+ i.month = static_cast<unsigned int> (v.month ());
+ i.day = static_cast<unsigned int> (v.day ());
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QDate>
+ {
+ static const database_type_id db_type_id = id_date;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_MYSQL_QDATE_TRAITS_HXX
diff --git a/odb/qt/date-time/mysql/qtime-traits.hxx b/odb/qt/date-time/mysql/qtime-traits.hxx
new file mode 100644
index 0000000..69cd49c
--- /dev/null
+++ b/odb/qt/date-time/mysql/qtime-traits.hxx
@@ -0,0 +1,69 @@
+// file : odb/qt/date-time/mysql/qtime-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_MYSQL_QTIME_TRAITS_HXX
+#define ODB_QT_DATE_TIME_MYSQL_QTIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <QTime>
+
+#include <odb/mysql/traits.hxx>
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ class default_value_traits<QTime, MYSQL_TIME, id_time>
+ {
+ public:
+ typedef QTime value_type;
+ typedef QTime query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (QTime& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ // A null QTime value is equivalent to an invalid QTime value.
+ // Set v to an invalid time to represent null (hour value of
+ // a valid time must be in the range 0-23).
+ //
+ v.setHMS (24, 0, 0);
+ else
+ v.setHMS (static_cast<int> (i.hour),
+ static_cast<int> (i.minute),
+ static_cast<int> (i.second));
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const QTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+
+ i.neg = false;
+ i.day = 0;
+
+ i.hour = static_cast<unsigned int> (v.hour ());
+ i.minute = static_cast<unsigned int> (v.minute ());
+ i.second = static_cast<unsigned int> (v.second ());
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QTime>
+ {
+ static const database_type_id db_type_id = id_time;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_MYSQL_QTIME_TRAITS_HXX
diff --git a/odb/qt/date-time/sqlite/default-mapping.hxx b/odb/qt/date-time/sqlite/default-mapping.hxx
new file mode 100644
index 0000000..82321af
--- /dev/null
+++ b/odb/qt/date-time/sqlite/default-mapping.hxx
@@ -0,0 +1,28 @@
+// file : odb/qt/date-time/sqlite/default-mapping.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_SQLITE_DEFAULT_MAPPING_HXX
+#define ODB_QT_DATE_TIME_SQLITE_DEFAULT_MAPPING_HXX
+
+#include <QDate>
+#include <QTime>
+#include <QDateTime>
+
+// Map QDate to SQLite TEXT by default. QDate provides a null representation
+// so allow NULL values by default.
+//
+#pragma db value(QDate) type("TEXT")
+
+// Map QTime to SQLite TEXT by default. QTime provides a null representation
+// so allow NULL values by default.
+//
+#pragma db value(QTime) type("TEXT")
+
+// Map QDateTime to SQLite TEXT by default. QDateTime provides a null
+// representation so allow NULL values by default.
+//
+#pragma db value(QDateTime) type("TEXT")
+
+#endif // 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
new file mode 100644
index 0000000..85c4c1a
--- /dev/null
+++ b/odb/qt/date-time/sqlite/qdate-time-traits.hxx
@@ -0,0 +1,123 @@
+// file : odb/qt/date-time/sqlite/qdatetime-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_SQLITE_QDATETIME_TRAITS_HXX
+#define ODB_QT_DATE_TIME_SQLITE_QDATETIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <string>
+#include <cstddef> // std::size_t
+#include <cstring> // std::memcpy
+
+#include <QDateTime>
+
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+#include <odb/qt/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ class default_value_traits<QDateTime, details::buffer, id_text>
+ {
+ public:
+ typedef QDateTime value_type;
+ typedef QDateTime query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (QDateTime& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ // Default constructor creates a null QDateTime.
+ //
+ v = QDateTime ();
+ else
+ v = QDateTime::fromString (
+ QString::fromAscii (i.data (), static_cast<int> (n)),
+ "yyyy-MM-ddTHH:mm:ss.zzz");
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const QDateTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+
+ std::string s (
+ v.toString ("yyyy-MM-ddTHH:mm:ss.zzz").toStdString ());
+
+ n = s.size ();
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ // Implementation of mapping between QDateTime and SQLite INTEGER.
+ // The integer value represents UNIX time.
+ //
+ template <>
+ class default_value_traits<QDateTime, long long, id_integer>
+ {
+ public:
+ typedef QDateTime value_type;
+ typedef QDateTime query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (QDateTime& v, long long i, bool is_null)
+ {
+ if (is_null)
+ // Default constructor creates a null QDateTime.
+ //
+ v = QDateTime ();
+ else
+ {
+ v.setTimeSpec (Qt::UTC);
+ v.setTime_t (static_cast <uint> (i));
+ }
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const QDateTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else if (v < QDateTime (QDate (1970, 1, 1),
+ QTime (0, 0, 0),
+ Qt::UTC))
+ throw odb::qt::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i = static_cast<long long> (v.toTime_t ());
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QDateTime>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_SQLITE_QDATETIME_TRAITS_HXX
diff --git a/odb/qt/date-time/sqlite/qdate-traits.hxx b/odb/qt/date-time/sqlite/qdate-traits.hxx
new file mode 100644
index 0000000..d8df614
--- /dev/null
+++ b/odb/qt/date-time/sqlite/qdate-traits.hxx
@@ -0,0 +1,126 @@
+// file : odb/qt/date-time/sqlite/qdate-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_SQLITE_QDATE_TRAITS_HXX
+#define ODB_QT_DATE_TIME_SQLITE_QDATE_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <string>
+#include <cstddef> // std::size_t
+#include <cstring> // std::memcpy
+
+#include <QDate>
+
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+#include <odb/qt/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ class default_value_traits<QDate, details::buffer, id_text>
+ {
+ public:
+ typedef QDate value_type;
+ typedef QDate query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (QDate& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ // A null QDate value is equivalent to an invalid QDate value.
+ // Set v to an invalid date to represent null.
+ //
+ v.setDate (0, 0, 0);
+ else
+ v = QDate::fromString (
+ QString::fromAscii (i.data (), static_cast<int> (n)),
+ "yyyy-MM-dd");
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const QDate& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+
+ std::string s (v.toString ("yyyy-MM-dd").toStdString ());
+
+ n = s.size ();
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ // Implementation of the mapping between QDate and SQLite INTEGER. The
+ // integer value represents UNIX time.
+ //
+ template <>
+ class default_value_traits<QDate, long long, id_integer>
+ {
+ public:
+ typedef QDate value_type;
+ typedef QDate query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (QDate& v, long long i, bool is_null)
+ {
+ if (is_null)
+ // A null QDate value is equivalent to an invalid QDate value.
+ // Set v to an invalid date to represent null.
+ //
+ v.setDate (0, 0, 0);
+ else
+ {
+ QDateTime dt;
+ dt.setTimeSpec (Qt::UTC);
+ dt.setTime_t(static_cast<uint> (i));
+
+ v = dt.date ();
+ }
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const QDate& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else if (v < QDate (1970, 1, 1))
+ throw odb::qt::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i = static_cast<long long> (
+ QDateTime (v, QTime (0, 0, 0), Qt::UTC).toTime_t ());
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QDate>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_SQLITE_QDATE_TRAITS_HXX
diff --git a/odb/qt/date-time/sqlite/qtime-traits.hxx b/odb/qt/date-time/sqlite/qtime-traits.hxx
new file mode 100644
index 0000000..84721ee
--- /dev/null
+++ b/odb/qt/date-time/sqlite/qtime-traits.hxx
@@ -0,0 +1,118 @@
+// file : odb/qt/date-time/sqlite/qtime-traits.hxx
+// author : Constantin Michael <constantin@codesynthesis.com>
+// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_QT_DATE_TIME_SQLITE_QTIME_TRAITS_HXX
+#define ODB_QT_DATE_TIME_SQLITE_QTIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <string>
+#include <cstddef> // std::size_t
+#include <cstring> // std::memcpy
+
+#include <QTime>
+
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ class default_value_traits<QTime, details::buffer, id_text>
+ {
+ public:
+ typedef QTime value_type;
+ typedef QTime query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (QTime& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ // A null QTime value is equivalent to an invalid QTime value.
+ // Set v to an invalid time to represent null (hour value of
+ // a valid time must be in the range 0-23).
+ //
+ v.setHMS (24, 0, 0);
+ else
+ v = QTime::fromString (
+ QString::fromAscii (i.data (), static_cast<int> (n)),
+ "HH:mm:ss.zzz");
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const QTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+
+ std::string s (v.toString ("HH:mm:ss.zzz").toStdString ());
+
+ n = s.size ();
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ // Implementation of mapping between QTime and SQLite INTEGER. The
+ // integer value represents seconds since midnight.
+ //
+ template <>
+ class default_value_traits<QTime, long long, id_integer>
+ {
+ public:
+ typedef QTime value_type;
+ typedef QTime query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (QTime& v, long long i, bool is_null)
+ {
+ if (is_null)
+ // A null QTime value is equivalent to an invalid QTime value.
+ // Set v to an invalid time to represent null (hour value of
+ // a valid time must be in the range 0-23).
+ //
+ v.setHMS (24, 0, 0);
+ else
+ v = QTime (0, 0, 0).addSecs (static_cast<int> (i));
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const QTime& v)
+ {
+ if (v.isNull ())
+ is_null = true;
+ else
+ {
+ is_null = false;
+ i = static_cast<long long> (QTime (0, 0, 0).secsTo (v));
+ }
+ }
+ };
+
+ template <>
+ class default_type_traits<QTime>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#endif // ODB_QT_DATE_TIME_SQLITE_QTIME_TRAITS_HXX
diff --git a/odb/qt/dummy.cxx b/odb/qt/dummy.cxx
deleted file mode 100644
index 81468bc..0000000
--- a/odb/qt/dummy.cxx
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <odb/qt/dummy.hxx>
-#include <odb/qt/exception.hxx>
-
-namespace odb
-{
- namespace qt
- {
- QString dummy ()
- {
- QString s ("Hello, Qt!");
- return s;
- }
- }
-}
diff --git a/odb/qt/dummy.hxx b/odb/qt/dummy.hxx
deleted file mode 100644
index e35625a..0000000
--- a/odb/qt/dummy.hxx
+++ /dev/null
@@ -1,12 +0,0 @@
-// Force compilation and creation of libodb-qt library for now.
-//
-#include <QString>
-#include <odb/qt/details/export.hxx>
-
-namespace odb
-{
- namespace qt
- {
- LIBODB_QT_EXPORT QString dummy ();
- }
-}
diff --git a/odb/qt/exception.hxx b/odb/qt/exception.hxx
index 6bf0699..0e09977 100644
--- a/odb/qt/exception.hxx
+++ b/odb/qt/exception.hxx
@@ -1,5 +1,5 @@
// file : odb/qt/exception.hxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
+// author : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2005-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
diff --git a/odb/qt/libodb-qt-vc10.vcxproj b/odb/qt/libodb-qt-vc10.vcxproj
index fb50334..6ea6610 100644
--- a/odb/qt/libodb-qt-vc10.vcxproj
+++ b/odb/qt/libodb-qt-vc10.vcxproj
@@ -88,7 +88,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -106,7 +106,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -126,7 +126,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@@ -148,7 +148,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4355;4800;4290;4251;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
diff --git a/odb/qt/libodb-qt-vc9.vcproj b/odb/qt/libodb-qt-vc9.vcproj
index 471538a..328e6b1 100644
--- a/odb/qt/libodb-qt-vc9.vcproj
+++ b/odb/qt/libodb-qt-vc9.vcproj
@@ -46,7 +46,7 @@
AdditionalOptions="/wd4355 /wd4800 /wd4290"
Optimization="0"
AdditionalIncludeDirectories="..\.."
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -124,7 +124,7 @@
AdditionalOptions="/wd4355 /wd4800 /wd4290"
Optimization="0"
AdditionalIncludeDirectories="..\.."
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -203,7 +203,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\.."
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -284,7 +284,7 @@
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="..\.."
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBODB_QT_DYNAMIC_LIB;"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
diff --git a/odb/qt/makefile b/odb/qt/makefile
index 756edd0..b806dac 100644
--- a/odb/qt/makefile
+++ b/odb/qt/makefile
@@ -5,7 +5,7 @@
include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-cxx := dummy.cxx
+cxx := date-time/exceptions.cxx
cxx_tun := $(cxx)
cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
diff --git a/odb/qt/mysql/default-mapping.hxx b/odb/qt/mysql/default-mapping.hxx
deleted file mode 100644
index 6a948c4..0000000
--- a/odb/qt/mysql/default-mapping.hxx
+++ /dev/null
@@ -1,30 +0,0 @@
-// file : qt/mysql/default-mapping.hxx
-// author : Constantin Michael <constantin@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_QT_MYSQL_DEFAULT_MAPPING_HXX
-#define ODB_QT_MYSQL_DEFAULT_MAPPING_HXX
-
-#include <QString>
-#include <QDate>
-#include <QTime>
-#include <QDateTime>
-
-// Map QString to MySQL TEXT by default.
-//
-#pragma db value(QString) type("VARCHAR(56) NOT NULL")
-
-// Map QDate to MySQL DATE by default.
-//
-#pragma db value(QDate) type("DATE")
-
-// Map QTime to MySQL TIME by default.
-//
-#pragma db value(QTime) type("TIME")
-
-// Map QTime to MySQL DATETIME by default.
-//
-#pragma db value(QDateTime) type("DATETIME")
-
-#endif // ODB_QT_MYSQL_DEFAULT_MAPPING_HXX
diff --git a/odb/qt/mysql/qdate-traits.hxx b/odb/qt/mysql/qdate-traits.hxx
deleted file mode 100644
index 168e6f9..0000000
--- a/odb/qt/mysql/qdate-traits.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-// file : odb/qt/mysql/qdate-traits.hxx
-// author : Constantin Michael <constantin@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_QT_MYSQL_QDATE_TRAITS_HXX
-#define ODB_QT_MYSQL_QDATE_TRAITS_HXX
-
-#include <odb/pre.hxx>
-
-#include <QDate>
-
-#include <odb/mysql/traits.hxx>
-
-namespace odb
-{
- namespace mysql
- {
- template <>
- class default_value_traits<QDate, MYSQL_TIME, id_date>
- {
- public:
- typedef QDate value_type;
- typedef QDate query_type;
- typedef MYSQL_TIME image_type;
-
- static void
- set_value (QDate& v, const MYSQL_TIME& i, bool is_null)
- {
- if (is_null)
- // Set the date to be invalid.
- //
- v.setDate (0, 0, 0);
- else
- v.setDate (i.year, i.month, i.day);
- }
-
- static void
- set_image (MYSQL_TIME& i, bool& is_null, const QDate& v)
- {
- if (v.isNull ())
- is_null = true;
- else
- {
- is_null = false;
- i.year = v.year ();
- i.month = v.month ();
- i.day = v.day ();
- }
- }
- };
- }
-}
-
-#endif // ODB_QT_MYSQL_QDATE_TRAITS_HXX
diff --git a/odb/qt/mysql/qdatetime-traits.hxx b/odb/qt/mysql/qdatetime-traits.hxx
deleted file mode 100644
index 75cb05e..0000000
--- a/odb/qt/mysql/qdatetime-traits.hxx
+++ /dev/null
@@ -1,109 +0,0 @@
-// file : odb/qt/mysql/qdatetime-traits.hxx
-// author : Constantin Michael <constantin@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_QT_MYSQL_QDATETIME_TRAITS_HXX
-#define ODB_QT_MYSQL_QDATETIME_TRAITS_HXX
-
-#include <odb/pre.hxx>
-
-#include <QDateTime>
-
-#include <odb/mysql/traits.hxx>
-
-namespace odb
-{
- namespace mysql
- {
- template <>
- class default_value_traits<QDateTime, MYSQL_TIME, id_datetime>
- {
- public:
- typedef QDateTime value_type;
- typedef QDateTime query_type;
- typedef MYSQL_TIME image_type;
-
- static void
- set_value (QDateTime& v, const MYSQL_TIME& i, bool is_null)
- {
- if (is_null)
- // Set the date part to be invalid.
- //
- v.setDate (QDate (0, 0, 0));
- else
- {
- v.setDate (QDate (i.year, i.month, i.day));
- v.setTime (QTime (i.hour, i.minute, i.second));
- }
- }
-
- static void
- set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v)
- {
- 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 ();
-
- const QTime& t (v.time ());
- i.hour = t.hour ();
- i.minute = t.minute ();
- i.second = t.second ();
- }
- }
- };
-
- template <>
- class default_value_traits<QDateTime, MYSQL_TIME, id_timestamp>
- {
- public:
- typedef QDateTime value_type;
- typedef QDateTime query_type;
- typedef MYSQL_TIME image_type;
-
- static void
- set_value (QDateTime& v, const MYSQL_TIME& i, bool is_null)
- {
- if (is_null)
- // Set the date part to be invalid.
- //
- v.setDate (QDate (0, 0, 0));
- else
- {
- v.setDate (QDate (i.year, i.month, i.day));
- v.setTime (QTime (i.hour, i.minute, i.second));
- }
- }
-
- static void
- set_image (MYSQL_TIME& i, bool& is_null, const QDateTime& v)
- {
- 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 ();
-
- const QTime& t (v.time ());
- i.hour = t.hour ();
- i.minute = t.minute ();
- i.second = t.second ();
- }
- }
- };
- }
-}
-
-#endif // ODB_QT_MYSQL_QDATETIME_TRAITS_HXX
diff --git a/odb/qt/mysql/qtime-traits.hxx b/odb/qt/mysql/qtime-traits.hxx
deleted file mode 100644
index 9789114..0000000
--- a/odb/qt/mysql/qtime-traits.hxx
+++ /dev/null
@@ -1,55 +0,0 @@
-// file : odb/qt/mysql/qtime-traits.hxx
-// author : Constantin Michael <constantin@codesynthesis.com>
-// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-// license : GNU GPL v2; see accompanying LICENSE file
-
-#ifndef ODB_QT_MYSQL_QTIME_TRAITS_HXX
-#define ODB_QT_MYSQL_QTIME_TRAITS_HXX
-
-#include <odb/pre.hxx>
-
-#include <QTime>
-
-#include <odb/mysql/traits.hxx>
-
-namespace odb
-{
- namespace mysql
- {
- template <>
- class default_value_traits<QTime, MYSQL_TIME, id_time>
- {
- public:
- typedef QTime value_type;
- typedef QTime query_type;
- typedef MYSQL_TIME image_type;
-
- static void
- set_value (QTime& v, const MYSQL_TIME& i, bool is_null)
- {
- if (is_null)
- // Set the time to be invalid.
- //
- v.setHMS (24, 0, 0);
- else
- v.setHMS (i.hour, i.minute, i.second);
- }
-
- static void
- set_image (MYSQL_TIME& i, bool& is_null, const QTime& v)
- {
- if (v.isNull ())
- is_null = true;
- else
- {
- is_null = false;
- i.hour = v.hour ();
- i.minute = v.minute ();
- i.second = v.second ();
- }
- }
- };
- }
-}
-
-#endif // ODB_QT_MYSQL_QTIME_TRAITS_HXX
diff --git a/odb/qt/version.hxx b/odb/qt/version.hxx
index 88ca1a1..9f97768 100644
--- a/odb/qt/version.hxx
+++ b/odb/qt/version.hxx
@@ -29,15 +29,15 @@
// Check that we have compatible ODB version.
//
-#if ODB_VERSION != 10200
+#if ODB_VERSION != 10251
# error incompatible odb interface version detected
#endif
// libodb-qt version: odb interface version plus the bugfix
// version.
//
-#define LIBODB_QT_VERSION 1020000
-#define LIBODB_QT_VERSION_STR "1.2.0"
+#define LIBODB_QT_VERSION 1029951
+#define LIBODB_QT_VERSION_STR "1.3.0.b1"
#include <odb/post.hxx>
diff --git a/odb/qt/version.options b/odb/qt/version.options
index cdecaf3..13285bc 100644
--- a/odb/qt/version.options
+++ b/odb/qt/version.options
@@ -8,6 +8,6 @@
#
--hxx-prologue '#include <odb/qt/version.hxx>'
---hxx-prologue '#if LIBODB_QT_VERSION != 1020000 // 1.2.0'
+--hxx-prologue '#if LIBODB_QT_VERSION != 1029951 // 1.3.0.b1'
--hxx-prologue '# error ODB and C++ compilers see different libodb-qt versions'
--hxx-prologue '#endif'
diff --git a/version b/version
index 26aaba0..c92d778 100644
--- a/version
+++ b/version
@@ -1 +1 @@
-1.2.0
+1.3.0.b1