summaryrefslogtreecommitdiff
path: root/libodb-boost/odb/boost/date-time
diff options
context:
space:
mode:
Diffstat (limited to 'libodb-boost/odb/boost/date-time')
-rw-r--r--libodb-boost/odb/boost/date-time/exceptions.cxx37
-rw-r--r--libodb-boost/odb/boost/date-time/exceptions.hxx43
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-common.options4
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-mssql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-mysql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-oracle.options11
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-pgsql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/gregorian-sqlite.options11
-rw-r--r--libodb-boost/odb/boost/date-time/mssql/gregorian-mapping.hxx15
-rw-r--r--libodb-boost/odb/boost/date-time/mssql/gregorian-traits.hxx68
-rw-r--r--libodb-boost/odb/boost/date-time/mssql/posix-time-mapping.hxx21
-rw-r--r--libodb-boost/odb/boost/date-time/mssql/posix-time-traits.hxx194
-rw-r--r--libodb-boost/odb/boost/date-time/mysql/gregorian-mapping.hxx14
-rw-r--r--libodb-boost/odb/boost/date-time/mysql/gregorian-traits.hxx72
-rw-r--r--libodb-boost/odb/boost/date-time/mysql/posix-time-mapping.hxx19
-rw-r--r--libodb-boost/odb/boost/date-time/mysql/posix-time-traits.hxx238
-rw-r--r--libodb-boost/odb/boost/date-time/oracle/gregorian-mapping.hxx14
-rw-r--r--libodb-boost/odb/boost/date-time/oracle/gregorian-traits.hxx83
-rw-r--r--libodb-boost/odb/boost/date-time/oracle/posix-time-mapping.hxx20
-rw-r--r--libodb-boost/odb/boost/date-time/oracle/posix-time-traits.hxx237
-rw-r--r--libodb-boost/odb/boost/date-time/pgsql/gregorian-mapping.hxx14
-rw-r--r--libodb-boost/odb/boost/date-time/pgsql/gregorian-traits.hxx69
-rw-r--r--libodb-boost/odb/boost/date-time/pgsql/posix-time-mapping.hxx19
-rw-r--r--libodb-boost/odb/boost/date-time/pgsql/posix-time-traits.hxx169
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-common.options4
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-mssql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-mysql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-oracle.options11
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-pgsql.options11
-rw-r--r--libodb-boost/odb/boost/date-time/posix-time-sqlite.options11
-rw-r--r--libodb-boost/odb/boost/date-time/sqlite/gregorian-mapping.hxx14
-rw-r--r--libodb-boost/odb/boost/date-time/sqlite/gregorian-traits.hxx133
-rw-r--r--libodb-boost/odb/boost/date-time/sqlite/posix-time-mapping.hxx19
-rw-r--r--libodb-boost/odb/boost/date-time/sqlite/posix-time-traits.hxx238
34 files changed, 1868 insertions, 0 deletions
diff --git a/libodb-boost/odb/boost/date-time/exceptions.cxx b/libodb-boost/odb/boost/date-time/exceptions.cxx
new file mode 100644
index 0000000..3ba8132
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/exceptions.cxx
@@ -0,0 +1,37 @@
+// file : odb/boost/date-time/exceptions.cxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace boost
+ {
+ namespace date_time
+ {
+ const char* special_value::
+ what () const ODB_NOTHROW_NOEXCEPT
+ {
+ return "unrepresentable date/time special value";
+ }
+
+ special_value* special_value::
+ clone () const
+ {
+ return new special_value (*this);
+ }
+
+ const char* value_out_of_range::
+ what () const ODB_NOTHROW_NOEXCEPT
+ {
+ return "date/time value out of range";
+ }
+
+ value_out_of_range* value_out_of_range::
+ clone () const
+ {
+ return new value_out_of_range (*this);
+ }
+ }
+ }
+}
diff --git a/libodb-boost/odb/boost/date-time/exceptions.hxx b/libodb-boost/odb/boost/date-time/exceptions.hxx
new file mode 100644
index 0000000..321f8da
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/exceptions.hxx
@@ -0,0 +1,43 @@
+// file : odb/boost/date-time/exceptions.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_EXCEPTIONS_HXX
+#define ODB_BOOST_DATE_TIME_EXCEPTIONS_HXX
+
+#include <odb/pre.hxx>
+
+#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT
+
+#include <odb/boost/exception.hxx>
+#include <odb/boost/details/export.hxx>
+
+namespace odb
+{
+ namespace boost
+ {
+ namespace date_time
+ {
+ struct LIBODB_BOOST_EXPORT special_value: exception
+ {
+ virtual const char*
+ what () const ODB_NOTHROW_NOEXCEPT;
+
+ virtual special_value*
+ clone () const;
+ };
+
+ struct LIBODB_BOOST_EXPORT value_out_of_range: exception
+ {
+ virtual const char*
+ what () const ODB_NOTHROW_NOEXCEPT;
+
+ virtual value_out_of_range*
+ clone () const;
+ };
+ }
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_EXCEPTIONS_HXX
diff --git a/libodb-boost/odb/boost/date-time/gregorian-common.options b/libodb-boost/odb/boost/date-time/gregorian-common.options
new file mode 100644
index 0000000..dfb0b87
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-common.options
@@ -0,0 +1,4 @@
+# file : odb/boost/date-time/gregorian-common.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
diff --git a/libodb-boost/odb/boost/date-time/gregorian-mssql.options b/libodb-boost/odb/boost/date-time/gregorian-mssql.options
new file mode 100644
index 0000000..971d19d
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-mssql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/gregorian-mssql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/mssql/gregorian-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/mssql/gregorian-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/gregorian-mysql.options b/libodb-boost/odb/boost/date-time/gregorian-mysql.options
new file mode 100644
index 0000000..927dc70
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-mysql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/gregorian-mysql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/mysql/gregorian-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/mysql/gregorian-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/gregorian-oracle.options b/libodb-boost/odb/boost/date-time/gregorian-oracle.options
new file mode 100644
index 0000000..fca3670
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-oracle.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/gregorian-oracle.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/oracle/gregorian-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/oracle/gregorian-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/gregorian-pgsql.options b/libodb-boost/odb/boost/date-time/gregorian-pgsql.options
new file mode 100644
index 0000000..bf6726a
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-pgsql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/gregorian-pgsql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/pgsql/gregorian-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/pgsql/gregorian-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/gregorian-sqlite.options b/libodb-boost/odb/boost/date-time/gregorian-sqlite.options
new file mode 100644
index 0000000..355791c
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/gregorian-sqlite.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/gregorian-sqlite.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/sqlite/gregorian-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/sqlite/gregorian-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/mssql/gregorian-mapping.hxx b/libodb-boost/odb/boost/date-time/mssql/gregorian-mapping.hxx
new file mode 100644
index 0000000..9c64542
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mssql/gregorian-mapping.hxx
@@ -0,0 +1,15 @@
+// file : odb/boost/date-time/mssql/gregorian-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_MAPPING_HXX
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+// By default map boost::gregorian::date to SQL Server DATE (available
+// only since SQL Server 2008). We use the NULL value to represent
+// not_a_date_time.
+//
+#pragma db value(boost::gregorian::date) type("DATE") null
+
+#endif // ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/mssql/gregorian-traits.hxx b/libodb-boost/odb/boost/date-time/mssql/gregorian-traits.hxx
new file mode 100644
index 0000000..b2b9a16
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mssql/gregorian-traits.hxx
@@ -0,0 +1,68 @@
+// file : odb/boost/date-time/mssql/gregorian-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/mssql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace mssql
+ {
+ template <>
+ class default_value_traits< ::boost::gregorian::date, id_date>
+ {
+ public:
+ typedef ::boost::gregorian::date value_type;
+ typedef value_type query_type;
+ typedef date image_type;
+
+ static void
+ set_value (value_type& v, const date& i, bool is_null)
+ {
+ if (is_null)
+ v = value_type (::boost::date_time::not_a_date_time);
+ else
+ v = value_type (static_cast<value_type::year_type> (i.year),
+ static_cast<value_type::month_type> (i.month),
+ static_cast<value_type::day_type> (i.day));
+ }
+
+ static void
+ set_image (date& i, bool& is_null, const value_type& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+ i.year = static_cast<SQLSMALLINT> (v.year ());
+ i.month = static_cast<SQLUSMALLINT> (v.month ());
+ i.day = static_cast<SQLUSMALLINT> (v.day ());
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::gregorian::date>
+ {
+ static const database_type_id db_type_id = id_date;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_MSSQL_GREGORIAN_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/mssql/posix-time-mapping.hxx b/libodb-boost/odb/boost/date-time/mssql/posix-time-mapping.hxx
new file mode 100644
index 0000000..0682dda
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mssql/posix-time-mapping.hxx
@@ -0,0 +1,21 @@
+// file : odb/boost/date-time/mssql/posix-time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_MAPPING_HXX
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// By default map boost::posix_time::ptime to SQL Server DATETIME2
+// (available only since SQL Server 2008). We use the NULL value to
+// represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::ptime) type("DATETIME2") null
+
+// By default map boost::posix_time::time_duration to SQL Server TIME
+// (available only since SQL Server 2008). We use the NULL value to
+// represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::time_duration) type("TIME") null
+
+#endif // ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/mssql/posix-time-traits.hxx b/libodb-boost/odb/boost/date-time/mssql/posix-time-traits.hxx
new file mode 100644
index 0000000..88d0c82
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mssql/posix-time-traits.hxx
@@ -0,0 +1,194 @@
+// file : odb/boost/date-time/mssql/posix-time-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/mssql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace mssql
+ {
+ template <>
+ class default_value_traits< ::boost::posix_time::ptime, id_datetime>
+ {
+ public:
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::gregorian::date date;
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef datetime image_type;
+
+ static void
+ set_value (ptime& v, const datetime& i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ unsigned long long fract_s (i.fraction);
+ fract_s = fract_s * time_duration::ticks_per_second () /
+ 1000000000ULL;
+
+ v = ptime (
+ date (static_cast<date::year_type> (i.year),
+ static_cast<date::month_type> (i.month),
+ static_cast<date::day_type> (i.day)),
+ time_duration (
+ static_cast<time_duration::hour_type> (i.hour),
+ static_cast<time_duration::min_type> (i.minute),
+ static_cast<time_duration::sec_type> (i.second),
+ static_cast<time_duration::fractional_seconds_type> (fract_s)));
+ }
+ }
+
+ static void
+ set_image (datetime& i, unsigned short s, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ const date& d (v.date ());
+ const time_duration& t (v.time_of_day ());
+
+ is_null = false;
+ i.year = static_cast<SQLSMALLINT> (d.year ());
+ i.month = static_cast<SQLUSMALLINT> (d.month ());
+ i.day = static_cast<SQLUSMALLINT> (d.day ());
+ i.hour = static_cast<SQLUSMALLINT> (t.hours ());
+ i.minute = static_cast<SQLUSMALLINT> (t.minutes ());
+
+ // Scale value 8 indicates we are dealing with SMALLDATETIME
+ // which has the minutes precision.
+ //
+ if (s != 8)
+ {
+ i.second = static_cast<SQLUSMALLINT> (t.seconds ());
+
+ unsigned long long ns (t.fractional_seconds ());
+ ns = ns * 1000000000ULL / time_duration::ticks_per_second ();
+
+ const unsigned int divider[8] =
+ {
+ 1000000000,
+ 100000000,
+ 10000000,
+ 1000000,
+ 100000,
+ 10000,
+ 1000,
+ 100
+ };
+
+ i.fraction = static_cast<SQLUINTEGER> (ns - ns % divider[s]);
+ }
+ else
+ {
+ i.second = 0;
+ i.fraction = 0;
+ }
+ }
+ }
+ };
+
+ template <>
+ class default_value_traits< ::boost::posix_time::time_duration, id_time>
+ {
+ public:
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef time image_type;
+
+ static void
+ set_value (time_duration& v, const time& i, bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ {
+ unsigned long long fract_s (i.fraction);
+ fract_s = fract_s * time_duration::ticks_per_second () /
+ 1000000000ULL;
+
+ v = time_duration (
+ static_cast<time_duration::hour_type> (i.hour),
+ static_cast<time_duration::min_type> (i.minute),
+ static_cast<time_duration::sec_type> (i.second),
+ static_cast<time_duration::fractional_seconds_type> (fract_s));
+ }
+ }
+
+ static void
+ set_image (time& i,
+ unsigned short s,
+ bool& is_null,
+ const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else if (v.is_negative () || v.hours () > 23)
+ throw odb::boost::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i.hour = static_cast<SQLUSMALLINT> (v.hours ());
+ i.minute = static_cast<SQLUSMALLINT> (v.minutes ());
+ i.second = static_cast<SQLUSMALLINT> (v.seconds ());
+
+ unsigned long long ns (v.fractional_seconds ());
+ ns = ns * 1000000000ULL / time_duration::ticks_per_second ();
+
+ const unsigned int divider[8] =
+ {
+ 1000000000,
+ 100000000,
+ 10000000,
+ 1000000,
+ 100000,
+ 10000,
+ 1000,
+ 100
+ };
+
+ i.fraction = static_cast<SQLUINTEGER> (ns - ns % divider[s]);
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::ptime>
+ {
+ static const database_type_id db_type_id = id_datetime;
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::time_duration>
+ {
+ static const database_type_id db_type_id = id_time;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_MSSQL_POSIX_TIME_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/mysql/gregorian-mapping.hxx b/libodb-boost/odb/boost/date-time/mysql/gregorian-mapping.hxx
new file mode 100644
index 0000000..9d23274
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mysql/gregorian-mapping.hxx
@@ -0,0 +1,14 @@
+// file : odb/boost/date-time/mysql/gregorian-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_MAPPING_HXX
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+// By default map boost::gregorian::date to MySQL DATE. We use the
+// NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::gregorian::date) type("DATE") null
+
+#endif // ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/mysql/gregorian-traits.hxx b/libodb-boost/odb/boost/date-time/mysql/gregorian-traits.hxx
new file mode 100644
index 0000000..6b29dc5
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mysql/gregorian-traits.hxx
@@ -0,0 +1,72 @@
+// file : odb/boost/date-time/mysql/gregorian-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/mysql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ struct default_value_traits< ::boost::gregorian::date, id_date>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef date value_type;
+ typedef date query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (date& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ v = date (::boost::date_time::not_a_date_time);
+ else
+ v = date (i.year, i.month, i.day);
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const date& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+ i.neg = false;
+ i.year = v.year ();
+ i.month = v.month ();
+ i.day = v.day ();
+
+ i.hour = 0;
+ i.minute = 0;
+ i.second = 0;
+ i.second_part = 0;
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::gregorian::date>
+ {
+ static const database_type_id db_type_id = id_date;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_MYSQL_GREGORIAN_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/mysql/posix-time-mapping.hxx b/libodb-boost/odb/boost/date-time/mysql/posix-time-mapping.hxx
new file mode 100644
index 0000000..f3908b3
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mysql/posix-time-mapping.hxx
@@ -0,0 +1,19 @@
+// file : odb/boost/date-time/mysql/posix-time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_MAPPING_HXX
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// By default map boost::posix_time::ptime to MySQL DATETIME. We use
+// the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::ptime) type("DATETIME") null
+
+// By default map boost::posix_time::time_duration to MySQL TIME. We
+// use the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::time_duration) type("TIME") null
+
+#endif // ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/mysql/posix-time-traits.hxx b/libodb-boost/odb/boost/date-time/mysql/posix-time-traits.hxx
new file mode 100644
index 0000000..28c42c1
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/mysql/posix-time-traits.hxx
@@ -0,0 +1,238 @@
+// file : odb/boost/date-time/mysql/posix-time-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <cstdlib> // std::abs
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/mysql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace mysql
+ {
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_datetime>
+ {
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::gregorian::date date;
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (ptime& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ // Since MySQL 5.6.4, the microseconds part is no longer ignored.
+ //
+ unsigned long long fract_s (i.second_part);
+ fract_s = fract_s * time_duration::ticks_per_second () / 1000000ULL;
+
+ v = ptime (
+ date (i.year, i.month, i.day),
+ time_duration (
+ i.hour,
+ i.minute,
+ i.second,
+ static_cast<time_duration::fractional_seconds_type> (fract_s)));
+ }
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+ i.neg = false;
+
+ const date& d (v.date ());
+ i.year = d.year ();
+ i.month = d.month ();
+ i.day = d.day ();
+
+ const time_duration& t (v.time_of_day ());
+ i.hour = t.hours ();
+ i.minute = t.minutes ();
+ i.second = t.seconds ();
+
+ unsigned long long ms (t.fractional_seconds ());
+ ms = ms * 1000000ULL / time_duration::ticks_per_second ();
+ i.second_part = static_cast<unsigned long> (ms);
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_timestamp>
+ {
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::gregorian::date date;
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef MYSQL_TIME image_type;
+
+ static void
+ set_value (ptime& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ // Since MySQL 5.6.4, the microseconds part is no longer ignored.
+ //
+ unsigned long long fract_s (i.second_part);
+ fract_s = fract_s * time_duration::ticks_per_second () / 1000000ULL;
+
+ v = ptime (
+ date (i.year, i.month, i.day),
+ time_duration (
+ i.hour,
+ i.minute,
+ i.second,
+ static_cast<time_duration::fractional_seconds_type> (fract_s)));
+ }
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else if (v < ptime (date (1970, ::boost::date_time::Jan, 1),
+ time_duration (0, 0, 1)) ||
+ v > ptime (date (2038, ::boost::date_time::Jan, 19),
+ time_duration (3, 14, 7)))
+ throw odb::boost::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i.neg = false;
+
+ const date& d (v.date ());
+ i.year = d.year ();
+ i.month = d.month ();
+ i.day = d.day ();
+
+ const time_duration& t (v.time_of_day ());
+ i.hour = t.hours ();
+ i.minute = t.minutes ();
+ i.second = t.seconds ();
+
+ unsigned long long ms (t.fractional_seconds ());
+ ms = ms * 1000000ULL / time_duration::ticks_per_second ();
+ i.second_part = static_cast<unsigned long> (ms);
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::time_duration, id_time>
+ {
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef MYSQL_TIME image_type;
+
+ static const unsigned short max_hours = 838;
+
+ static void
+ set_value (time_duration& v, const MYSQL_TIME& i, bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ {
+ // Since MySQL 5.6.4, the microseconds part is no longer ignored.
+ //
+ unsigned long long fract_s (i.second_part);
+ fract_s = fract_s * time_duration::ticks_per_second () / 1000000ULL;
+
+ v = time_duration (
+ i.hour,
+ i.minute,
+ i.second,
+ static_cast<time_duration::fractional_seconds_type> (fract_s));
+
+ if (i.neg)
+ v = v.invert_sign ();
+ }
+ }
+
+ static void
+ set_image (MYSQL_TIME& i, bool& is_null, const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else if (std::abs (v.hours ()) > max_hours)
+ throw odb::boost::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i.neg = v.is_negative ();
+
+ i.year = 0;
+ i.month = 0;
+ i.day = 0;
+
+ i.hour = std::abs (v.hours ());
+ i.minute = std::abs (v.minutes ());
+ i.second = std::abs (v.seconds ());
+
+ // Some compilers, e.g., VC8, don't have 64-bit abs() overload.
+ //
+ time_duration::fractional_seconds_type sms (v.fractional_seconds ());
+ unsigned long long ms (sms >= 0 ? sms : -sms);
+ ms = ms * 1000000ULL / time_duration::ticks_per_second ();
+ i.second_part = static_cast<unsigned long> (ms);
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::ptime>
+ {
+ static const database_type_id db_type_id = id_datetime;
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::time_duration>
+ {
+ static const database_type_id db_type_id = id_time;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_MYSQL_POSIX_TIME_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/oracle/gregorian-mapping.hxx b/libodb-boost/odb/boost/date-time/oracle/gregorian-mapping.hxx
new file mode 100644
index 0000000..65ad008
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/oracle/gregorian-mapping.hxx
@@ -0,0 +1,14 @@
+// file : odb/boost/date-time/oracle/gregorian-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_MAPPING_HXX
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+// By default map boost::gregorian::date to Oracle DATE. We use the
+// NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::gregorian::date) type("DATE") null
+
+#endif // ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/oracle/gregorian-traits.hxx b/libodb-boost/odb/boost/date-time/oracle/gregorian-traits.hxx
new file mode 100644
index 0000000..9e02e25
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/oracle/gregorian-traits.hxx
@@ -0,0 +1,83 @@
+// file : odb/boost/date-time/oracle/gregorian-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+#include <odb/core.hxx>
+
+#include <odb/oracle/traits.hxx>
+#include <odb/oracle/details/date.hxx>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace oracle
+ {
+ template <>
+ struct default_value_traits< ::boost::gregorian::date, id_date>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef date value_type;
+ typedef date query_type;
+ typedef char* image_type;
+
+ static void
+ set_value (date& v, const char* b, bool is_null)
+ {
+ if (is_null)
+ v = date (::boost::date_time::not_a_date_time);
+ else
+ {
+ short y;
+ unsigned char m, d, h, minute, s;
+
+ details::get_date (b, y, m, d, h, minute, s);
+
+ v = date (static_cast<date::year_type> (y),
+ static_cast<date::month_type> (m),
+ static_cast<date::day_type> (d));
+ }
+ }
+
+ static void
+ set_image (char* b, bool& is_null, const date& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ details::set_date (b,
+ static_cast<short> (v.year ()),
+ static_cast<unsigned char> (v.month ()),
+ static_cast<unsigned char> (v.day ()),
+ 0,
+ 0,
+ 0);
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::gregorian::date>
+ {
+ static const database_type_id db_type_id = id_date;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_ORACLE_GREGORIAN_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/oracle/posix-time-mapping.hxx b/libodb-boost/odb/boost/date-time/oracle/posix-time-mapping.hxx
new file mode 100644
index 0000000..26c642f
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/oracle/posix-time-mapping.hxx
@@ -0,0 +1,20 @@
+// file : odb/boost/date-time/oracle/posix-time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_MAPPING_HXX
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// By default map boost::posix_time::ptime to Oracle TIMESTAMP. We use the NULL
+// value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::ptime) type("TIMESTAMP") null
+
+// By default map boost::posix_time::time_duration to Oracle
+// INTERVAL DAY TO SECOND. We use the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::time_duration) \
+ type("INTERVAL DAY TO SECOND") null
+
+#endif // ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/oracle/posix-time-traits.hxx b/libodb-boost/odb/boost/date-time/oracle/posix-time-traits.hxx
new file mode 100644
index 0000000..1f830e0
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/oracle/posix-time-traits.hxx
@@ -0,0 +1,237 @@
+// file : odb/boost/date-time/oracle/posix-time-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+
+#include <odb/oracle/traits.hxx>
+#include <odb/oracle/oracle-fwd.hxx> // ub1, sb2, ub4
+#include <odb/oracle/oracle-types.hxx> // odb::oracle::{datetime interval_ds}
+#include <odb/oracle/details/date.hxx>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace oracle
+ {
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_timestamp>
+ {
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::gregorian::date date;
+
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef datetime image_type;
+
+ static void
+ set_value (ptime& v, const datetime& i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ sb2 y;
+ ub1 m, d, h, minute, s;
+ ub4 ns;
+
+ i.get (y, m, d, h, minute, s, ns);
+
+ unsigned long long fract_s (ns);
+ fract_s = fract_s * time_duration::ticks_per_second () /
+ 1000000000ULL;
+
+ v = ptime (
+ date (static_cast<date::year_type> (y),
+ static_cast<date::month_type> (m),
+ static_cast<date::day_type> (d)),
+ time_duration (
+ static_cast<time_duration::hour_type> (h),
+ static_cast<time_duration::min_type> (minute),
+ static_cast<time_duration::sec_type> (s),
+ static_cast<time_duration::fractional_seconds_type> (fract_s)));
+ }
+ }
+
+ static void
+ set_image (datetime& i, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ const date& d (v.date ());
+ const time_duration& t (v.time_of_day ());
+
+ unsigned long long ns (t.fractional_seconds ());
+ ns = ns * 1000000000ULL / time_duration::ticks_per_second ();
+
+ i.set (static_cast<sb2> (d.year ()),
+ static_cast<ub1> (d.month ()),
+ static_cast<ub1> (d.day ()),
+ static_cast<ub1> (t.hours ()),
+ static_cast<ub1> (t.minutes ()),
+ static_cast<ub1> (t.seconds ()),
+ static_cast<ub4> (ns));
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_date>
+ {
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::gregorian::date date;
+
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef char* image_type;
+
+ static void
+ set_value (ptime& v, const char* b, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ short y;
+ unsigned char m, d, h, minute, s;
+
+ details::get_date (b, y, m, d, h, minute, s);
+
+ v = ptime (
+ date (static_cast<date::year_type> (y),
+ static_cast<date::month_type> (m),
+ static_cast<date::day_type> (d)),
+ time_duration (
+ static_cast<time_duration::hour_type> (h),
+ static_cast<time_duration::min_type> (minute),
+ static_cast<time_duration::sec_type> (s),
+ 0));
+ }
+ }
+
+ static void
+ set_image (char* b, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ const date& d (v.date ());
+ const time_duration& t (v.time_of_day ());
+
+ details::set_date (b,
+ static_cast<short> (d.year ()),
+ static_cast<unsigned char> (d.month ()),
+ static_cast<unsigned char> (d.day ()),
+ static_cast<unsigned char> (t.hours ()),
+ static_cast<unsigned char> (t.minutes ()),
+ static_cast<unsigned char> (t.seconds ()));
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::time_duration,
+ id_interval_ds>
+ {
+ typedef ::boost::posix_time::time_duration time_duration;
+
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef interval_ds image_type;
+
+ static void
+ set_value (time_duration& v,
+ const interval_ds& i,
+ bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ {
+ sb4 d, h, m, s, ns;
+ i.get (d, h, m, s, ns);
+
+ unsigned long long fract_s (ns);
+ fract_s = fract_s * time_duration::ticks_per_second () /
+ 1000000000ULL;
+
+ v = time_duration (
+ static_cast<time_duration::hour_type> (
+ static_cast<unsigned long long> (d) * 24 + h),
+ static_cast<time_duration::min_type> (m),
+ static_cast<time_duration::sec_type> (s),
+ static_cast<time_duration::fractional_seconds_type> (fract_s));
+ }
+ }
+
+ static void
+ set_image (interval_ds& i,
+ bool& is_null,
+ const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ unsigned long long ns (v.fractional_seconds ());
+ ns = ns * 1000000000ULL / time_duration::ticks_per_second ();
+
+ i.set (0,
+ static_cast<sb4> (v.hours ()),
+ static_cast<sb4> (v.minutes ()),
+ static_cast<sb4> (v.seconds ()),
+ static_cast<sb4> (ns));
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::ptime>
+ {
+ static const database_type_id db_type_id = id_timestamp;
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::time_duration>
+ {
+ static const database_type_id db_type_id = id_interval_ds;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_ORACLE_POSIX_TIME_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/pgsql/gregorian-mapping.hxx b/libodb-boost/odb/boost/date-time/pgsql/gregorian-mapping.hxx
new file mode 100644
index 0000000..36a9334
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/pgsql/gregorian-mapping.hxx
@@ -0,0 +1,14 @@
+// file : odb/boost/date-time/pgsql/gregorian-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_MAPPING_HXX
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+// By default map boost::gregorian::date to PostgreSQL DATE. We use the
+// NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::gregorian::date) type("DATE") null
+
+#endif // ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/pgsql/gregorian-traits.hxx b/libodb-boost/odb/boost/date-time/pgsql/gregorian-traits.hxx
new file mode 100644
index 0000000..a0dcce2
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/pgsql/gregorian-traits.hxx
@@ -0,0 +1,69 @@
+// file : odb/boost/date-time/pgsql/gregorian-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/pgsql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace pgsql
+ {
+ template <>
+ struct default_value_traits< ::boost::gregorian::date, id_date>
+ {
+ typedef ::boost::gregorian::date date;
+
+ typedef details::endian_traits endian_traits;
+
+ typedef date value_type;
+ typedef date query_type;
+ typedef int image_type;
+
+ static void
+ set_value (date& v, int i, bool is_null)
+ {
+ if (is_null)
+ v = date (::boost::date_time::not_a_date_time);
+ else
+ v = date (2000, 1, 1) + ::boost::gregorian::date_duration (
+ endian_traits::ntoh (i));
+ }
+
+ static void
+ set_image (int& i, bool& is_null, const date& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+ i = endian_traits::hton (
+ static_cast<int> ((v - date (2000, 1, 1)).days ()));
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::gregorian::date>
+ {
+ static const database_type_id db_type_id = id_date;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_PGSQL_GREGORIAN_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/pgsql/posix-time-mapping.hxx b/libodb-boost/odb/boost/date-time/pgsql/posix-time-mapping.hxx
new file mode 100644
index 0000000..ace906d
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/pgsql/posix-time-mapping.hxx
@@ -0,0 +1,19 @@
+// file : odb/boost/date-time/pgsql/posix-time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_MAPPING_HXX
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// By default map boost::posix_time::ptime to PostgreSQL TIMESTAMP. We use
+// the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::ptime) type("TIMESTAMP") null
+
+// By default map boost::posix_time::time_duration to PostgreSQL TIME. We
+// use the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::time_duration) type("TIME") null
+
+#endif // ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/pgsql/posix-time-traits.hxx b/libodb-boost/odb/boost/date-time/pgsql/posix-time-traits.hxx
new file mode 100644
index 0000000..6713adc
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/pgsql/posix-time-traits.hxx
@@ -0,0 +1,169 @@
+// file : odb/boost/date-time/pgsql/posix-time-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+#include <odb/core.hxx>
+#include <odb/pgsql/traits.hxx>
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace pgsql
+ {
+ // Implementation of the mapping between boost::posix_time::ptime and
+ // PostgreSQL TIMESTAMP. TIMESTAMP values are stored as micro-seconds
+ // since the PostgreSQL epoch 2000-01-01.
+ //
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_timestamp>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+
+ typedef details::endian_traits endian_traits;
+
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef long long image_type;
+
+ static const long long neg_inf = -0x7fffffffffffffffLL - 1;
+ static const long long pos_inf = 0x7fffffffffffffffLL;
+
+ static void
+ set_value (ptime& v, long long i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ {
+ i = endian_traits::ntoh (i);
+
+ if (i == neg_inf)
+ v = ptime (::boost::date_time::neg_infin);
+ else if (i == pos_inf)
+ v = ptime (::boost::date_time::pos_infin);
+ else
+ {
+ const ptime pg_epoch (date (2000, 1, 1),
+ time_duration (0, 0, 0));
+
+ // We need to split the microsecond image into hours and
+ // microseconds to avoid overflow during the fractional seconds
+ // calculation.
+ //
+ time_duration::hour_type h (
+ static_cast<time_duration::hour_type> (i / 3600000000LL));
+
+ i -= static_cast<long long> (h) * 3600000000LL;
+
+ v = pg_epoch +
+ time_duration (
+ h,
+ 0,
+ 0,
+ static_cast<time_duration::fractional_seconds_type> (
+ i * time_duration::ticks_per_second () / 1000000LL));
+ }
+ }
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const ptime& v)
+ {
+ is_null = false;
+
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else if (v.is_neg_infinity ())
+ i = endian_traits::hton (neg_inf);
+ else if (v.is_pos_infinity ())
+ i = endian_traits::hton (pos_inf);
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ const ptime pg_epoch (date (2000, 1, 1), time_duration (0, 0, 0));
+ i = endian_traits::hton (
+ static_cast<long long> ((v - pg_epoch).total_microseconds ()));
+ }
+ }
+ };
+
+ // Implementation of the mapping between boost::posix_time::time_duration
+ // and PostgreSQL TIME. The TIME values are stored as micro-seconds since
+ // 00:00:00.
+ //
+ template <>
+ struct default_value_traits< ::boost::posix_time::time_duration, id_time>
+ {
+ typedef ::boost::posix_time::time_duration time_duration;
+
+ typedef details::endian_traits endian_traits;
+
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (time_duration& v, long long i, bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ v = time_duration (
+ 0,
+ 0,
+ 0,
+ static_cast<time_duration::fractional_seconds_type> (
+ endian_traits::ntoh (i) * time_duration::ticks_per_second () /
+ 1000000LL));
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else if (v.hours () < 0 || v.hours () > 24)
+ throw odb::boost::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+ i = endian_traits::hton (
+ static_cast<long long> (v.total_microseconds ()));
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::ptime>
+ {
+ static const database_type_id db_type_id = id_timestamp;
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::time_duration>
+ {
+ static const database_type_id db_type_id = id_time;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_PGSQL_POSIX_TIME_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/posix-time-common.options b/libodb-boost/odb/boost/date-time/posix-time-common.options
new file mode 100644
index 0000000..9421eeb
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-common.options
@@ -0,0 +1,4 @@
+# file : odb/boost/date-time/posix-time-common.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
diff --git a/libodb-boost/odb/boost/date-time/posix-time-mssql.options b/libodb-boost/odb/boost/date-time/posix-time-mssql.options
new file mode 100644
index 0000000..656c718
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-mssql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/posix-time-mssql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/mssql/posix-time-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/mssql/posix-time-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/posix-time-mysql.options b/libodb-boost/odb/boost/date-time/posix-time-mysql.options
new file mode 100644
index 0000000..5d5677d
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-mysql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/posix-time-mysql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/mysql/posix-time-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/mysql/posix-time-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/posix-time-oracle.options b/libodb-boost/odb/boost/date-time/posix-time-oracle.options
new file mode 100644
index 0000000..0812568
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-oracle.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/posix-time-oracle.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/oracle/posix-time-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/oracle/posix-time-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/posix-time-pgsql.options b/libodb-boost/odb/boost/date-time/posix-time-pgsql.options
new file mode 100644
index 0000000..d2830ff
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-pgsql.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/posix-time-pgsql.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/pgsql/posix-time-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/pgsql/posix-time-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/posix-time-sqlite.options b/libodb-boost/odb/boost/date-time/posix-time-sqlite.options
new file mode 100644
index 0000000..bbe52dd
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/posix-time-sqlite.options
@@ -0,0 +1,11 @@
+# file : odb/boost/date-time/posix-time-sqlite.options
+# license : GNU GPL v2; see accompanying LICENSE file
+
+--profile boost/version
+
+# Include the default mapping in prologue instead of epilogue to
+# allow the user to override the default mapping.
+#
+--odb-prologue '#include <odb/boost/date-time/sqlite/posix-time-mapping.hxx>'
+
+--hxx-prologue '#include <odb/boost/date-time/sqlite/posix-time-traits.hxx>'
diff --git a/libodb-boost/odb/boost/date-time/sqlite/gregorian-mapping.hxx b/libodb-boost/odb/boost/date-time/sqlite/gregorian-mapping.hxx
new file mode 100644
index 0000000..9880927
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/sqlite/gregorian-mapping.hxx
@@ -0,0 +1,14 @@
+// file : odb/boost/date-time/sqlite/gregorian-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_MAPPING_HXX
+
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+
+// By default map boost::gregorian::date to TEXT. We use the
+// NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::gregorian::date) type("TEXT") null
+
+#endif // ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/sqlite/gregorian-traits.hxx b/libodb-boost/odb/boost/date-time/sqlite/gregorian-traits.hxx
new file mode 100644
index 0000000..b48b4dd
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/sqlite/gregorian-traits.hxx
@@ -0,0 +1,133 @@
+// file : odb/boost/date-time/sqlite/gregorian-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <string>
+#include <cstddef> // std::size_t
+#include <cstring> // std::memcpy
+#include <ctime> // std::time_t
+
+#include <boost/date_time/gregorian/gregorian_types.hpp> // date
+#include <boost/date_time/posix_time/posix_time_types.hpp> // time_duration
+#include <boost/date_time/gregorian/parsers.hpp> // from_simple_string
+#include <boost/date_time/gregorian/formatters.hpp> // to_iso_extended_string
+#include <boost/date_time/posix_time/conversion.hpp> // from_time_t
+
+#include <odb/core.hxx>
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ struct default_value_traits< ::boost::gregorian::date, id_text>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef date value_type;
+ typedef date query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (date& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = date (::boost::date_time::not_a_date_time);
+ else
+ v = ::boost::gregorian::from_simple_string (
+ std::string (i.data (), n));
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const date& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ const std::string& s (
+ ::boost::gregorian::to_iso_extended_string (v));
+
+ n = s.size ();
+
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::gregorian::date, id_integer>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ::boost::posix_time::ptime ptime;
+ typedef date value_type;
+ typedef date query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (date& v, long long i, bool is_null)
+ {
+ if (is_null)
+ v = date (::boost::date_time::not_a_date_time);
+ else
+ v = ::boost::posix_time::from_time_t (
+ static_cast<std::time_t> (i)).date ();
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const date& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ ptime epoch (date (1970, 1, 1), time_duration (0, 0, 0));
+ i = static_cast<long long> (
+ (ptime (v, time_duration (0, 0, 0)) - epoch).ticks () /
+ time_duration::ticks_per_second ());
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::gregorian::date>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_SQLITE_GREGORIAN_TRAITS_HXX
diff --git a/libodb-boost/odb/boost/date-time/sqlite/posix-time-mapping.hxx b/libodb-boost/odb/boost/date-time/sqlite/posix-time-mapping.hxx
new file mode 100644
index 0000000..544a7aa
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/sqlite/posix-time-mapping.hxx
@@ -0,0 +1,19 @@
+// file : odb/boost/date-time/sqlite/posix-time-mapping.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_MAPPING_HXX
+#define ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_MAPPING_HXX
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// By default map boost::posix_time::ptime to TEXT. We use
+// the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::ptime) type("TEXT") null
+
+// By default map boost::posix_time::time_duration to TEXT. We
+// use the NULL value to represent not_a_date_time.
+//
+#pragma db value(boost::posix_time::time_duration) type("TEXT") null
+
+#endif // ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_MAPPING_HXX
diff --git a/libodb-boost/odb/boost/date-time/sqlite/posix-time-traits.hxx b/libodb-boost/odb/boost/date-time/sqlite/posix-time-traits.hxx
new file mode 100644
index 0000000..482f203
--- /dev/null
+++ b/libodb-boost/odb/boost/date-time/sqlite/posix-time-traits.hxx
@@ -0,0 +1,238 @@
+// file : odb/boost/date-time/sqlite/posix-time-traits.hxx
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#ifndef ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_TRAITS_HXX
+#define ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_TRAITS_HXX
+
+#include <odb/pre.hxx>
+
+#include <string>
+#include <cstddef> // std::size_t
+#include <cstring> // std::memcpy
+#include <ctime> // std::time_t
+
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/date_time/posix_time/time_parsers.hpp> // time_from_string
+#include <boost/date_time/posix_time/time_formatters.hpp> // to_simple_string
+#include <boost/date_time/posix_time/conversion.hpp> // from_time_t
+
+#include <odb/core.hxx>
+#include <odb/details/buffer.hxx>
+#include <odb/sqlite/traits.hxx>
+
+#include <odb/boost/date-time/exceptions.hxx>
+
+namespace odb
+{
+ namespace sqlite
+ {
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_text>
+ {
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (ptime& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ v = ::boost::posix_time::time_from_string (
+ std::string (i.data (), n));
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ std::string s (::boost::posix_time::to_iso_extended_string (v));
+
+ // Replace ',' in iso string with '.'. SQLite requires the
+ // latter for date/time functions.
+ //
+ std::size_t p = s.rfind (',');
+ if (p != std::string::npos)
+ s[p] = '.';
+
+ // Remove 'T' separator as Boost is unable to parse correctly.
+ //
+ p = s.find ('T');
+ if (p != std::string::npos)
+ s[p] = ' ';
+
+ n = s.size ();
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ // Implementation of the mapping between boost::posix_time::ptime and
+ // SQLite INTEGER. The integer value represents UNIX time.
+ //
+ template <>
+ struct default_value_traits< ::boost::posix_time::ptime, id_integer>
+ {
+ typedef ::boost::gregorian::date date;
+ typedef ::boost::posix_time::ptime ptime;
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef ptime value_type;
+ typedef ptime query_type;
+ typedef long long image_type;
+
+ static void
+ set_value (ptime& v, long long i, bool is_null)
+ {
+ if (is_null)
+ v = ptime (::boost::date_time::not_a_date_time);
+ else
+ v = ::boost::posix_time::from_time_t (static_cast<std::time_t> (i));
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const ptime& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+
+ ptime epoch (date (1970, 1, 1), time_duration (0, 0, 0));
+ i = static_cast<long long> (
+ (v - epoch).ticks () / time_duration::ticks_per_second ());
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::time_duration, id_text>
+ {
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (time_duration& v,
+ const details::buffer& i,
+ std::size_t n,
+ bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ {
+ v = ::boost::posix_time::duration_from_string (
+ std::string (i.data (), n));
+ }
+ }
+
+ static void
+ set_image (details::buffer& i,
+ std::size_t& n,
+ bool& is_null,
+ const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else if (v.total_seconds () < 0)
+ throw odb::boost::date_time::value_out_of_range ();
+ else
+ {
+ is_null = false;
+
+ const std::string& s (::boost::posix_time::to_simple_string (v));
+
+ n = s.size ();
+ if (n > i.capacity ())
+ i.capacity (n);
+
+ std::memcpy (i.data (), s.data (), n);
+ }
+ }
+ };
+
+ template <>
+ struct default_value_traits< ::boost::posix_time::time_duration, id_integer>
+ {
+ typedef ::boost::posix_time::time_duration time_duration;
+ typedef time_duration value_type;
+ typedef time_duration query_type;
+ typedef details::buffer image_type;
+
+ static void
+ set_value (time_duration& v, long long i, bool is_null)
+ {
+ if (is_null)
+ v = time_duration (::boost::date_time::not_a_date_time);
+ else
+ v = time_duration (0, 0, static_cast<time_duration::sec_type> (i));
+ }
+
+ static void
+ set_image (long long& i, bool& is_null, const time_duration& v)
+ {
+ if (v.is_special ())
+ {
+ if (v.is_not_a_date_time ())
+ is_null = true;
+ else
+ throw odb::boost::date_time::special_value ();
+ }
+ else
+ {
+ is_null = false;
+ i = static_cast<long long> (v.total_seconds ());
+ }
+ }
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::ptime>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+
+ template <>
+ struct default_type_traits< ::boost::posix_time::time_duration>
+ {
+ static const database_type_id db_type_id = id_text;
+ };
+ }
+}
+
+#include <odb/post.hxx>
+
+#endif // ODB_BOOST_DATE_TIME_SQLITE_POSIX_TIME_TRAITS_HXX