diff options
Diffstat (limited to 'libodb-boost/odb')
74 files changed, 4539 insertions, 0 deletions
diff --git a/libodb-boost/odb/boost.options b/libodb-boost/odb/boost.options new file mode 100644 index 0000000..bf8796e --- /dev/null +++ b/libodb-boost/odb/boost.options @@ -0,0 +1,10 @@ +# file : odb/boost.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/smart-ptr +--profile boost/optional +--profile boost/unordered +--profile boost/date-time +--profile boost/multi-index +--profile boost/uuid + diff --git a/libodb-boost/odb/boost/buildfile b/libodb-boost/odb/boost/buildfile new file mode 100644 index 0000000..b8dd6d1 --- /dev/null +++ b/libodb-boost/odb/boost/buildfile @@ -0,0 +1,65 @@ +# file : odb/boost/buildfile +# license : GNU GPL v2; see accompanying LICENSE file + +../ +{ + define options: file + options{*}: extension = options + + # Install into the odb/boost/ subdirectory of, say, /usr/include/ + # recreating subdirectories. + # + {hxx ixx txx options}{*}: + { + install = include/odb/ + install.subdirs = true + } + + boost/ + { + import int_libs = libodb%lib{odb} + imp_libs = + + lib{odb-boost}: {hxx ixx txx cxx}{** -version} hxx{version} \ + options{**} ../options{boost} \ + $imp_libs $int_libs + + # Include the generated version header into the distribution (so that we + # don't pick up an installed one) and don't remove it when cleaning in src + # (so that clean results in a state identical to distributed). + # + hxx{version}: in{version} $src_root/manifest + hxx{version}: + { + dist = true + clean = ($src_root != $out_root) + } + + # For pre-releases use the complete version to make sure they cannot be + # used in place of another pre-release or the final version. See the + # version module for details on the version.* variable values. + # + if $version.pre_release + lib{odb-boost}: bin.lib.version = @"-$version.project_id" + else + lib{odb-boost}: bin.lib.version = @"-$version.major.$version.minor" + + # Build options. + # + cxx.poptions =+ "-I$out_root" "-I$src_root" + + obja{*}: cxx.poptions += -DLIBODB_BOOST_STATIC_BUILD + objs{*}: cxx.poptions += -DLIBODB_BOOST_SHARED_BUILD + + # Export options. + # + lib{odb-boost}: + { + cxx.export.poptions = "-I$out_root" "-I$src_root" + cxx.export.libs = $int_libs + } + + liba{odb-boost}: cxx.export.poptions += -DLIBODB_BOOST_STATIC + libs{odb-boost}: cxx.export.poptions += -DLIBODB_BOOST_SHARED + } +} diff --git a/libodb-boost/odb/boost/date-time.options b/libodb-boost/odb/boost/date-time.options new file mode 100644 index 0000000..a3bd489 --- /dev/null +++ b/libodb-boost/odb/boost/date-time.options @@ -0,0 +1,5 @@ +# file : odb/boost/date-time.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/date-time/gregorian +--profile boost/date-time/posix-time 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 diff --git a/libodb-boost/odb/boost/details/config.hxx b/libodb-boost/odb/boost/details/config.hxx new file mode 100644 index 0000000..d5ddef8 --- /dev/null +++ b/libodb-boost/odb/boost/details/config.hxx @@ -0,0 +1,15 @@ +// file : odb/boost/details/config.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_DETAILS_CONFIG_HXX +#define ODB_BOOST_DETAILS_CONFIG_HXX + +// no pre + +#ifdef ODB_COMPILER +# define LIBODB_BOOST_STATIC +#endif + +// no post + +#endif // ODB_BOOST_DETAILS_CONFIG_HXX diff --git a/libodb-boost/odb/boost/details/export.hxx b/libodb-boost/odb/boost/details/export.hxx new file mode 100644 index 0000000..fa4e53c --- /dev/null +++ b/libodb-boost/odb/boost/details/export.hxx @@ -0,0 +1,46 @@ +// file : odb/boost/details/export.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_DETAILS_EXPORT_HXX +#define ODB_BOOST_DETAILS_EXPORT_HXX + +#include <odb/pre.hxx> + +#include <odb/boost/details/config.hxx> // LIBODB_BOOST_STATIC if ODB_COMPILER + +// Normally we don't export class templates (but do complete specializations), +// inline functions, and classes with only inline member functions. Exporting +// classes that inherit from non-exported/imported bases (e.g., std::string) +// will end up badly. The only known workarounds are to not inherit or to not +// export. Also, MinGW GCC doesn't like seeing non-exported function being +// used before their inline definition. The workaround is to reorder code. In +// the end it's all trial and error. + +#if defined(LIBODB_BOOST_STATIC) // Using static. +# define LIBODB_BOOST_EXPORT +#elif defined(LIBODB_BOOST_STATIC_BUILD) // Building static. +# define LIBODB_BOOST_EXPORT +#elif defined(LIBODB_BOOST_SHARED) // Using shared. +# ifdef _WIN32 +# define LIBODB_BOOST_EXPORT __declspec(dllimport) +# else +# define LIBODB_BOOST_EXPORT +# endif +#elif defined(LIBODB_BOOST_SHARED_BUILD) // Building shared. +# ifdef _WIN32 +# define LIBODB_BOOST_EXPORT __declspec(dllexport) +# else +# define LIBODB_BOOST_EXPORT +# endif +#else +// If none of the above macros are defined, then we assume we are being used +// by some third-party build system that cannot/doesn't signal the library +// type. Note that this fallback works for both static and shared but in case +// of shared will be sub-optimal compared to having dllimport. +// +# define LIBODB_BOOST_EXPORT // Using static or shared. +#endif + +#include <odb/post.hxx> + +#endif // ODB_BOOST_DETAILS_EXPORT_HXX diff --git a/libodb-boost/odb/boost/exception.hxx b/libodb-boost/odb/boost/exception.hxx new file mode 100644 index 0000000..f616a30 --- /dev/null +++ b/libodb-boost/odb/boost/exception.hxx @@ -0,0 +1,28 @@ +// file : odb/boost/exception.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_EXCEPTION_HXX +#define ODB_BOOST_EXCEPTION_HXX + +#include <odb/pre.hxx> + +#include <odb/exceptions.hxx> + +#include <odb/details/config.hxx> // ODB_NOTHROW_NOEXCEPT +#include <odb/boost/details/export.hxx> + +namespace odb +{ + namespace boost + { + struct LIBODB_BOOST_EXPORT exception: odb::exception + { + virtual const char* + what () const ODB_NOTHROW_NOEXCEPT = 0; + }; + } +} + +#include <odb/post.hxx> + +#endif // ODB_BOOST_EXCEPTION_HXX diff --git a/libodb-boost/odb/boost/lazy-ptr.hxx b/libodb-boost/odb/boost/lazy-ptr.hxx new file mode 100644 index 0000000..35a8acf --- /dev/null +++ b/libodb-boost/odb/boost/lazy-ptr.hxx @@ -0,0 +1,9 @@ +// file : odb/boost/lazy-ptr.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_LAZY_PTR_HXX +#define ODB_BOOST_LAZY_PTR_HXX + +#include <odb/boost/smart-ptr/lazy-ptr.hxx> + +#endif // ODB_BOOST_LAZY_PTR_HXX diff --git a/libodb-boost/odb/boost/multi-index.options b/libodb-boost/odb/boost/multi-index.options new file mode 100644 index 0000000..731d197 --- /dev/null +++ b/libodb-boost/odb/boost/multi-index.options @@ -0,0 +1,7 @@ +# file : odb/boost/multi-index.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/version + +--odb-epilogue '#include <odb/boost/multi-index/container-traits.hxx>' +--hxx-prologue '#include <odb/boost/multi-index/container-traits.hxx>' diff --git a/libodb-boost/odb/boost/multi-index/container-traits.hxx b/libodb-boost/odb/boost/multi-index/container-traits.hxx new file mode 100644 index 0000000..b027886 --- /dev/null +++ b/libodb-boost/odb/boost/multi-index/container-traits.hxx @@ -0,0 +1,215 @@ +// file : odb/boost/multi-index/container-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_MULTI_INDEX_CONTAINER_TRAITS_HXX +#define ODB_BOOST_MULTI_INDEX_CONTAINER_TRAITS_HXX + +#include <boost/version.hpp> + +// Multi-index container is available since 1.32.0. +// +#if BOOST_VERSION >= 103200 + +#include <odb/pre.hxx> + +#include <utility> // std::move + +#include <boost/mpl/find_if.hpp> +#include <boost/mpl/distance.hpp> +#include <boost/mpl/begin_end.hpp> + +#include <boost/multi_index_container.hpp> +#include <boost/multi_index/sequenced_index.hpp> +#include <boost/multi_index/random_access_index.hpp> + +#include <odb/container-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 + +namespace odb +{ + // Multi-index container can be ordered or set. Whether it is ordered + // depends on whether it has any sequenced or random_access indexes. + // If it is ordered, then we need to use one of these indexes to store + // elements in a specific order. Otherwise, we can use the first index + // since the order of elements in the database is not important. Note + // that there is a terminology clash between ODB and Boost multi-index. + // What ODB calls ordered containers, multi-index calls sequenced and + // random_access. And what ODB calls set containers, multi-index calls + // ordered and hashed. + // + + // Test whether index is ordered. + // + template <typename I> + struct multi_index_ordered + { + static const bool value = false; + }; + + template <typename T> + struct multi_index_ordered< ::boost::multi_index::sequenced<T> > + { + static const bool value = true; + }; + + template <typename T> + struct multi_index_ordered< ::boost::multi_index::random_access<T> > + { + static const bool value = true; + }; + + // Get the index of the first ordered sub-index or -1 if none exists. + // + template <typename B, typename I, typename E> + struct multi_index_ordered_index + { + static const int value = ::boost::mpl::distance<B, I>::value; + }; + + template <typename B, typename E> + struct multi_index_ordered_index<B, E, E> + { + static const int value = -1; + }; + + template <typename V, + typename ISP, + typename A, + int N = + multi_index_ordered_index< + typename ::boost::mpl::begin<ISP>::type, + typename ::boost::mpl::find_if< + ISP, multi_index_ordered< ::boost::mpl::_1 > >::type, + typename ::boost::mpl::end<ISP>::type>::value> + class multi_index_traits + { + public: + static const container_kind kind = ck_ordered; + static const bool smart = false; + + typedef ::boost::multi_index_container<V, ISP, A> container_type; + typedef typename container_type::template nth_index<N>::type + ordered_container_type; + + typedef V value_type; + typedef typename ordered_container_type::size_type index_type; + + typedef ordered_functions<index_type, value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + const ordered_container_type& oc (c.template get<N> ()); + index_type i (0); + for (typename ordered_container_type::const_iterator j (oc.begin ()), + e (oc.end ()); j != e; ++j) + f.insert (i++, *j); + } + + static void + load (container_type& c, bool more, const functions& f) + { + ordered_container_type& oc (c.template get<N> ()); + oc.clear (); + + while (more) + { + index_type dummy; + value_type v; + more = f.select (dummy, v); +#ifdef ODB_CXX11 + oc.push_back (std::move (v)); +#else + oc.push_back (v); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + const ordered_container_type& oc (c.template get<N> ()); + index_type i (0); + for (typename ordered_container_type::const_iterator j (oc.begin ()), + e (oc.end ()); j != e; ++j) + f.insert (i++, *j); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; + + // Set specialization. + // + template <typename V, typename ISP, typename A> + class multi_index_traits<V, ISP, A, -1> + { + public: + static const container_kind kind = ck_set; + static const bool smart = false; + + typedef ::boost::multi_index_container<V, ISP, A> container_type; + typedef V value_type; + + typedef set_functions<value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + load (container_type& c, bool more, const functions& f) + { + c.clear (); + + while (more) + { + value_type v; + more = f.select (v); +#ifdef ODB_CXX11 + c.insert (std::move (v)); +#else + c.insert (v); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; + + template <typename V, typename ISP, typename A> + class access::container_traits< ::boost::multi_index_container<V, ISP, A> > + : public multi_index_traits<V, ISP, A> + { + }; +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_MULTI_INDEX_CONTAINER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/optional.options b/libodb-boost/odb/boost/optional.options new file mode 100644 index 0000000..d57b22b --- /dev/null +++ b/libodb-boost/odb/boost/optional.options @@ -0,0 +1,7 @@ +# file : odb/boost/optional.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/version + +--odb-epilogue '#include <odb/boost/optional/wrapper-traits.hxx>' +--hxx-prologue '#include <odb/boost/optional/wrapper-traits.hxx>' diff --git a/libodb-boost/odb/boost/optional/wrapper-traits.hxx b/libodb-boost/odb/boost/optional/wrapper-traits.hxx new file mode 100644 index 0000000..80d4319 --- /dev/null +++ b/libodb-boost/odb/boost/optional/wrapper-traits.hxx @@ -0,0 +1,63 @@ +// file : odb/boost/optional/wrapper-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_OPTIONAL_WRAPPER_TRAITS_HXX +#define ODB_BOOST_OPTIONAL_WRAPPER_TRAITS_HXX + +#include <odb/pre.hxx> + +#include <boost/none.hpp> +#include <boost/optional.hpp> + +#include <odb/wrapper-traits.hxx> + +namespace odb +{ + template <typename T> + class wrapper_traits< ::boost::optional<T> > + { + public: + typedef T wrapped_type; + typedef ::boost::optional<T> wrapper_type; + + // T can be const. + // + typedef + typename odb::details::meta::remove_const<T>::result + unrestricted_wrapped_type; + + static const bool null_handler = true; + static const bool null_default = true; + + static bool + get_null (const wrapper_type& o) + { + return !o; + } + + static void + set_null (wrapper_type& o) + { + o = ::boost::none; + } + + static const wrapped_type& + get_ref (const wrapper_type& o) + { + return *o; + } + + static unrestricted_wrapped_type& + set_ref (wrapper_type& o) + { + if (!o) + o = unrestricted_wrapped_type (); + + return const_cast<unrestricted_wrapped_type&> (*o); + } + }; +} + +#include <odb/post.hxx> + +#endif // ODB_BOOST_OPTIONAL_WRAPPER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/smart-ptr.options b/libodb-boost/odb/boost/smart-ptr.options new file mode 100644 index 0000000..2b0f2a4 --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr.options @@ -0,0 +1,19 @@ +# file : odb/boost/smart-ptr.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/version + +# Make boost::shared_ptr the default object pointer. +# +--hxx-prologue '#include <boost/shared_ptr.hpp>' +--default-pointer ::boost::shared_ptr + +# Include pointer traits. +# +--odb-epilogue '#include <odb/boost/smart-ptr/pointer-traits.hxx>' +--hxx-prologue '#include <odb/boost/smart-ptr/pointer-traits.hxx>' + +# Include wrapper traits. +# +--odb-epilogue '#include <odb/boost/smart-ptr/wrapper-traits.hxx>' +--hxx-prologue '#include <odb/boost/smart-ptr/wrapper-traits.hxx>' diff --git a/libodb-boost/odb/boost/smart-ptr/lazy-pointer-traits.hxx b/libodb-boost/odb/boost/smart-ptr/lazy-pointer-traits.hxx new file mode 100644 index 0000000..92b5441 --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/lazy-pointer-traits.hxx @@ -0,0 +1,61 @@ +// file : odb/boost/smart-ptr/lazy-pointer-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_SMART_PTR_LAZY_POINTER_TRAITS_HXX +#define ODB_BOOST_SMART_PTR_LAZY_POINTER_TRAITS_HXX + +#include <odb/pre.hxx> + +#include <odb/pointer-traits.hxx> +#include <odb/boost/smart-ptr/lazy-ptr.hxx> + +namespace odb +{ + template <typename T> + class pointer_traits<boost::lazy_shared_ptr<T> > + { + public: + static const pointer_kind kind = pk_shared; + static const bool lazy = true; + + typedef T element_type; + typedef boost::lazy_shared_ptr<element_type> pointer_type; + typedef ::boost::shared_ptr<element_type> eager_pointer_type; + + static bool + null_ptr (const pointer_type& p) + { + return !p; + } + + template <class O /* = T */> + static typename object_traits<O>::id_type + object_id (const pointer_type& p) + { + return p.template object_id<O> (); + } + }; + + template <typename T> + class pointer_traits<boost::lazy_weak_ptr<T> > + { + public: + static const pointer_kind kind = pk_weak; + static const bool lazy = true; + + typedef T element_type; + typedef boost::lazy_weak_ptr<element_type> pointer_type; + typedef boost::lazy_shared_ptr<element_type> strong_pointer_type; + typedef ::boost::weak_ptr<element_type> eager_pointer_type; + + static strong_pointer_type + lock (const pointer_type& p) + { + return p.lock (); + } + }; +} + +#include <odb/post.hxx> + +#endif // ODB_BOOST_SMART_PTR_LAZY_POINTER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/smart-ptr/lazy-ptr.hxx b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.hxx new file mode 100644 index 0000000..6b17b57 --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.hxx @@ -0,0 +1,291 @@ +// file : odb/boost/smart-ptr/lazy-ptr.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_SMART_PTR_LAZY_PTR_HXX +#define ODB_BOOST_SMART_PTR_LAZY_PTR_HXX + +#include <odb/pre.hxx> + +#include <memory> // std::unique_ptr, std::auto_ptr + +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + +#include <odb/forward.hxx> // odb::database +#include <odb/traits.hxx> +#include <odb/lazy-ptr-impl.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 + +namespace odb +{ + namespace boost + { + template <class T> + class lazy_weak_ptr; + + // + // + template <class T> + class lazy_shared_ptr + { + // The standard shared_ptr interface. + // + public: + typedef T element_type; + + lazy_shared_ptr (); + template <class Y> explicit lazy_shared_ptr (Y*); + template <class Y, class D> lazy_shared_ptr (Y*, D); + template <class Y, class D, class A> lazy_shared_ptr (Y*, D, A); + + lazy_shared_ptr (const lazy_shared_ptr&); + template <class Y> lazy_shared_ptr (const lazy_shared_ptr<Y>&); + template <class Y> explicit lazy_shared_ptr (const lazy_weak_ptr<Y>&); + +#ifdef ODB_CXX11 + template <class Y> explicit lazy_shared_ptr (std::unique_ptr<Y>&&); +#else + template <class Y> explicit lazy_shared_ptr (std::auto_ptr<Y>&); +#endif + + ~lazy_shared_ptr (); + + lazy_shared_ptr& operator= (const lazy_shared_ptr&); + template <class Y> lazy_shared_ptr& operator= (const lazy_shared_ptr<Y>&); + +#ifdef ODB_CXX11 + template <class Y> lazy_shared_ptr& operator= (std::unique_ptr<Y>&&); +#else + template <class Y> lazy_shared_ptr& operator= (std::auto_ptr<Y>&); +#endif + + void swap (lazy_shared_ptr&); + void reset (); + template <class Y> void reset (Y*); + template <class Y, class D> void reset (Y*, D); + template <class Y, class D, class A> void reset (Y*, D, A); + + T& operator* () const; + T* operator-> () const; + T* get () const; + + bool unique () const; + long use_count () const; + + typedef ::boost::shared_ptr<T> lazy_shared_ptr::*unspecified_bool_type; + operator unspecified_bool_type () const + { + return (p_ || i_) ? &lazy_shared_ptr::p_ : 0; + } + + // Initialization/assignment from shared_ptr and weak_ptr. + // + public: + template <class Y> lazy_shared_ptr (const ::boost::shared_ptr<Y>&); + template <class Y> explicit lazy_shared_ptr (const ::boost::weak_ptr<Y>&); + + template <class Y> lazy_shared_ptr& operator= (const ::boost::shared_ptr<Y>&); + + // Lazy loading interface. + // + public: + typedef odb::database database_type; + + // NULL loaded() + // + // true true NULL pointer to transient object + // false true valid pointer to persistent object + // true false unloaded pointer to persistent object + // false false valid pointer to transient object + // + bool loaded () const; + + ::boost::shared_ptr<T> load () const; + + // Unload the pointer. For transient objects this function is + // equivalent to reset(). + // + void unload () const; + + // Get the underlying eager pointer. If this is an unloaded pointer + // to a persistent object, then the returned pointer will be NULL. + // + ::boost::shared_ptr<T> get_eager () const; + + template <class DB, class ID> lazy_shared_ptr (DB&, const ID&); + template <class DB, class Y> lazy_shared_ptr (DB&, Y*); + template <class DB, class Y, class D> lazy_shared_ptr (DB&, Y*, D); + template <class DB, class Y, class D, class A> lazy_shared_ptr (DB&, Y*, D, A); + +#ifdef ODB_CXX11 + template <class DB, class Y> lazy_shared_ptr (DB&, std::unique_ptr<Y>&&); +#else + template <class DB, class Y> lazy_shared_ptr (DB&, std::auto_ptr<Y>&); +#endif + + template <class DB, class Y> lazy_shared_ptr (DB&, const ::boost::shared_ptr<Y>&); + template <class DB, class Y> lazy_shared_ptr (DB&, const ::boost::weak_ptr<Y>&); + + template <class DB, class ID> void reset (DB&, const ID&); + template <class DB, class Y> void reset (DB&, Y*); + template <class DB, class Y, class D> void reset (DB&, Y*, D); + template <class DB, class Y, class D, class A> void reset (DB&, Y*, D, A); + +#ifdef ODB_CXX11 + template <class DB, class Y> void reset (DB&, std::unique_ptr<Y>&&); +#else + template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&); +#endif + + template <class DB, class Y> void reset (DB&, const ::boost::shared_ptr<Y>&); + +#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT + template <class O = T> +#else + template <class O /* = T */> +#endif + typename object_traits<O>::id_type object_id () const; + + database_type& database () const; + + // Helpers. + // + public: + template <class Y> bool equal (const lazy_shared_ptr<Y>&) const; + + private: + template <class Y> friend class lazy_shared_ptr; + template <class Y> friend class lazy_weak_ptr; + + // For lazy_weak_ptr::lock(). + // + lazy_shared_ptr (const ::boost::shared_ptr<T>& p, + const lazy_ptr_impl<T>& i) + : p_ (p), i_ (i) {} + + private: + mutable ::boost::shared_ptr<T> p_; + mutable lazy_ptr_impl<T> i_; + }; + + // operator< and operator<< are not provided. + // + template<class T, class Y> + bool operator== (const lazy_shared_ptr<T>&, const lazy_shared_ptr<Y>&); + + template<class T, class Y> + bool operator!= (const lazy_shared_ptr<T>&, const lazy_shared_ptr<Y>&); + + template<class T> void swap (lazy_shared_ptr<T>&, lazy_shared_ptr<T>&); + + template<class D, class T> + D* get_deleter (const lazy_shared_ptr<T>&); + + // + // + template <class T> + class lazy_weak_ptr + { + // The standard weak_ptr interface. + // + public: + typedef T element_type; + + lazy_weak_ptr (); + template <class Y> lazy_weak_ptr (const lazy_shared_ptr<Y>&); + lazy_weak_ptr (const lazy_weak_ptr&); + template <class Y> lazy_weak_ptr (const lazy_weak_ptr<Y>&); + + ~lazy_weak_ptr (); + + lazy_weak_ptr& operator= (const lazy_weak_ptr&); + template <class Y> lazy_weak_ptr& operator= (const lazy_weak_ptr<Y>&); + template <class Y> lazy_weak_ptr& operator= (const lazy_shared_ptr<Y>&); + + void swap (lazy_weak_ptr<T>&); + void reset (); + + long use_count () const; + bool expired () const; + + lazy_shared_ptr<T> lock () const; + + // Initialization/assignment from shared_ptr and weak_ptr. + // + public: + template <class Y> lazy_weak_ptr (const ::boost::weak_ptr<Y>&); + template <class Y> lazy_weak_ptr (const ::boost::shared_ptr<Y>&); + + template <class Y> lazy_weak_ptr& operator= (const ::boost::weak_ptr<Y>&); + template <class Y> lazy_weak_ptr& operator= (const ::boost::shared_ptr<Y>&); + + // Lazy loading interface. + // + public: + typedef odb::database database_type; + + // expired() loaded() + // + // true true expired pointer to transient object + // false true valid pointer to persistent object + // true false expired pointer to persistent object + // false false valid pointer to transient object + // + bool loaded () const; + + // Performs both lock and load. + // + ::boost::shared_ptr<T> load () const; + + // Unload the pointer. For transient objects this function is + // equivalent to reset(). + // + void unload () const; + + // Get the underlying eager pointer. If this is an unloaded pointer + // to a persistent object, then the returned pointer will be NULL. + // + ::boost::weak_ptr<T> get_eager () const; + + template <class DB, class ID> lazy_weak_ptr (DB&, const ID&); + template <class DB, class Y> lazy_weak_ptr (DB&, const ::boost::shared_ptr<Y>&); + template <class DB, class Y> lazy_weak_ptr (DB&, const ::boost::weak_ptr<Y>&); + + template <class DB, class ID> void reset (DB&, const ID&); + template <class DB, class Y> void reset (DB&, const ::boost::shared_ptr<Y>&); + template <class DB, class Y> void reset (DB&, const ::boost::weak_ptr<Y>&); + + // The object_id() function can only be called when the object is + // persistent, or: expired() XOR loaded() (can use != for XOR). + // +#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT + template <class O = T> +#else + template <class O /* = T */> +#endif + typename object_traits<O>::id_type object_id () const; + + database_type& database () const; + + private: + template <class Y> friend class lazy_shared_ptr; + template <class Y> friend class lazy_weak_ptr; + + mutable ::boost::weak_ptr<T> p_; + mutable lazy_ptr_impl<T> i_; + }; + + // operator< is not provided. + // + template<class T> void swap (lazy_weak_ptr<T>&, lazy_weak_ptr<T>&); + } +} + +#include <odb/boost/smart-ptr/lazy-ptr.ixx> +#include <odb/boost/smart-ptr/lazy-ptr.txx> + +#include <odb/boost/smart-ptr/lazy-pointer-traits.hxx> + +#include <odb/post.hxx> + +#endif // ODB_BOOST_SMART_PTR_LAZY_PTR_HXX diff --git a/libodb-boost/odb/boost/smart-ptr/lazy-ptr.ixx b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.ixx new file mode 100644 index 0000000..f43dbbf --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.ixx @@ -0,0 +1,698 @@ +// file : odb/boost/smart-ptr/lazy-ptr.ixx +// license : GNU GPL v2; see accompanying LICENSE file + +#include <utility> // std::move() + +namespace odb +{ + namespace boost + { + // + // lazy_shared_ptr + // + + template <class T> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr () {} + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (Y* p): p_ (p) {} + + template <class T> + template <class Y, class D> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (Y* p, D d): p_ (p, d) {} + + template <class T> + template <class Y, class D, class A> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (Y* p, D d, A a): p_ (p, d, a) {} + + template <class T> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (const lazy_shared_ptr& r): p_ (r.p_), i_ (r.i_) {} + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (const lazy_shared_ptr<Y>& r): p_ (r.p_), i_ (r.i_) {} + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (const lazy_weak_ptr<Y>& r): i_ (r.i_) + { + // If the pointer has expired but can be re-loaded, then don't throw. + // + p_ = r.lock ().get_eager (); + + if (!p_ && !i_) + throw ::boost::bad_weak_ptr (); + } + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: +#ifdef ODB_CXX11 + lazy_shared_ptr (std::unique_ptr<Y>&& r): p_ (std::move (r)) {} +#else + lazy_shared_ptr (std::auto_ptr<Y>& r): p_ (r) {} +#endif + + template <class T> + inline lazy_shared_ptr<T>:: + ~lazy_shared_ptr () {} + + template <class T> + inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: + operator= (const lazy_shared_ptr& r) + { + p_ = r.p_; + i_ = r.i_; + return *this; + } + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: + operator= (const lazy_shared_ptr<Y>& r) + { + p_ = r.p_; + i_ = r.i_; + return *this; + } + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: +#ifdef ODB_CXX11 + operator= (std::unique_ptr<Y>&& r) + { + p_ = std::move (r); +#else + operator= (std::auto_ptr<Y>& r) + { + p_ = r; +#endif + i_.reset (); + return *this; + } + + template <class T> + inline void lazy_shared_ptr<T>:: + swap (lazy_shared_ptr& b) + { + p_.swap (b.p_); + i_.swap (b.i_); + } + + template <class T> + inline void lazy_shared_ptr<T>:: + reset () + { + p_.reset (); + i_.reset (); + } + + template <class T> + template <class Y> + inline void lazy_shared_ptr<T>:: + reset (Y* p) + { + p_.reset (p); + i_.reset (); + } + + template <class T> + template <class Y, class D> + inline void lazy_shared_ptr<T>:: + reset (Y* p, D d) + { + p_.reset (p, d); + i_.reset (); + } + + template <class T> + template <class Y, class D, class A> + inline void lazy_shared_ptr<T>:: + reset (Y* p, D d, A a) + { + p_.reset (p, d, a); + i_.reset (); + } + + template <class T> + inline T& lazy_shared_ptr<T>:: + operator* () const + { + return *p_; + } + + template <class T> + inline T* lazy_shared_ptr<T>:: + operator-> () const + { + return p_.operator-> (); + } + + template <class T> + inline T* lazy_shared_ptr<T>:: + get () const + { + return p_.get (); + } + + template <class T> + inline bool lazy_shared_ptr<T>:: + unique () const + { + return p_.unique (); + } + + template <class T> + inline long lazy_shared_ptr<T>:: + use_count () const + { + return p_.use_count (); + } + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (const ::boost::shared_ptr<Y>& r): p_ (r) {} + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (const ::boost::weak_ptr<Y>& r): p_ (r) {} + + template <class T> + template <class Y> + inline lazy_shared_ptr<T>& lazy_shared_ptr<T>:: + operator= (const ::boost::shared_ptr<Y>& r) + { + p_ = r; + i_.reset (); + return *this; + } + + template <class T> + inline bool lazy_shared_ptr<T>:: + loaded () const + { + bool i (i_); + return !p_ != i; // !p_ XOR i_ + } + + template <class T> + inline ::boost::shared_ptr<T> lazy_shared_ptr<T>:: + load () const + { + if (!p_ && i_) + p_ = i_.template load<T> (true); // Reset id. + + return p_; + } + + template <class T> + inline void lazy_shared_ptr<T>:: + unload () const + { + typedef typename object_traits<T>::object_type object_type; + + if (p_) + { + if (i_.database () != 0) + i_.reset_id (object_traits<object_type>::id (*p_)); + + p_.reset (); + } + } + + template <class T> + inline ::boost::shared_ptr<T> lazy_shared_ptr<T>:: + get_eager () const + { + return p_; + } + + template <class T> + template <class DB, class ID> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, const ID& id): i_ (db, id) {} + + template <class T> + template <class DB, class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, Y* p) + : p_ (p) + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class Y, class D> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, Y* p, D d) + : p_ (p, d) + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class Y, class D, class A> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, Y* p, D d, A a) + : p_ (p, d, a) + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class Y> + inline lazy_shared_ptr<T>:: +#ifdef ODB_CXX11 + lazy_shared_ptr (DB& db, std::unique_ptr<Y>&& r) + : p_ (std::move (r)) +#else + lazy_shared_ptr (DB& db, std::auto_ptr<Y>& r) + : p_ (r) +#endif + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, const ::boost::shared_ptr<Y>& r) + : p_ (r) + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class Y> + inline lazy_shared_ptr<T>:: + lazy_shared_ptr (DB& db, const ::boost::weak_ptr<Y>& r) + : p_ (r) + { + if (p_) + i_.reset_db (db); + } + + template <class T> + template <class DB, class ID> + inline void lazy_shared_ptr<T>:: + reset (DB& db, const ID& id) + { + p_.reset (); + i_.reset (db, id); + } + + template <class T> + template <class DB, class Y> + inline void lazy_shared_ptr<T>:: + reset (DB& db, Y* p) + { + p_.reset (p); + + if (p_) + i_.reset_db (db); + else + i_.reset (); + } + + template <class T> + template <class DB, class Y, class D> + inline void lazy_shared_ptr<T>:: + reset (DB& db, Y* p, D d) + { + p_.reset (p, d); + + if (p_) + i_.reset_db (db); + else + i_.reset (); + } + + template <class T> + template <class DB, class Y, class D, class A> + inline void lazy_shared_ptr<T>:: + reset (DB& db, Y* p, D d, A a) + { + p_.reset (p, d, a); + + if (p_) + i_.reset_db (db); + else + i_.reset (); + } + + template <class T> + template <class DB, class Y> + inline void lazy_shared_ptr<T>:: +#ifdef ODB_CXX11 + reset (DB& db, std::unique_ptr<Y>&& r) + { + p_ = std::move (r); +#else + reset (DB& db, std::auto_ptr<Y>& r) + { + p_ = r; +#endif + + if (p_) + i_.reset_db (db); + else + i_.reset (); + } + + template <class T> + template <class DB, class Y> + inline void lazy_shared_ptr<T>:: + reset (DB& db, const ::boost::shared_ptr<Y>& r) + { + p_ = r; + + if (p_) + i_.reset_db (db); + else + i_.reset (); + } + + template <class T> + template <class O> + inline typename object_traits<O>::id_type lazy_shared_ptr<T>:: + object_id () const + { + typedef typename object_traits<T>::object_type object_type; + + return p_ + ? object_traits<object_type>::id (*p_) + : i_.template object_id<O> (); + } + + template <class T> + inline typename lazy_shared_ptr<T>::database_type& lazy_shared_ptr<T>:: + database () const + { + return *i_.database (); + } + + template<class T, class Y> + inline bool + operator== (const lazy_shared_ptr<T>& a, const lazy_shared_ptr<Y>& b) + { + return a.equal (b); + } + + template<class T, class Y> + inline bool + operator!= (const lazy_shared_ptr<T>& a, const lazy_shared_ptr<Y>& b) + { + return !a.equal (b); + } + + template<class T> + inline void + swap (lazy_shared_ptr<T>& a, lazy_shared_ptr<T>& b) + { + a.swap (b); + } + + template<class D, class T> + inline D* + get_deleter (const lazy_shared_ptr<T>& p) + { + return ::boost::get_deleter<D> (p.p_); + } + + + // + // lazy_weak_ptr + // + + template <class T> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr () {} + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (const lazy_shared_ptr<Y>& r): p_ (r.p_), i_ (r.i_) {} + + template <class T> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (const lazy_weak_ptr& r): p_ (r.p_), i_ (r.i_) {} + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (const lazy_weak_ptr<Y>& r): p_ (r.p_), i_ (r.i_) {} + + template <class T> + inline lazy_weak_ptr<T>:: + ~lazy_weak_ptr () {} + + template <class T> + inline lazy_weak_ptr<T>& lazy_weak_ptr<T>:: + operator= (const lazy_weak_ptr& r) + { + p_ = r.p_; + i_ = r.i_; + return *this; + } + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>& lazy_weak_ptr<T>:: + operator= (const lazy_weak_ptr<Y>& r) + { + p_ = r.p_; + i_ = r.i_; + return *this; + } + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>& lazy_weak_ptr<T>:: + operator= (const lazy_shared_ptr<Y>& r) + { + p_ = r.p_; + i_ = r.i_; + return *this; + } + + template <class T> + inline void lazy_weak_ptr<T>:: + swap (lazy_weak_ptr<T>& r) + { + p_.swap (r.p_); + i_.swap (r.i_); + } + + template <class T> + inline void lazy_weak_ptr<T>:: + reset () + { + p_.reset (); + i_.reset (); + } + + template <class T> + inline long lazy_weak_ptr<T>:: + use_count () const + { + return p_.use_count (); + } + + template <class T> + inline bool lazy_weak_ptr<T>:: + expired () const + { + return p_.expired (); + } + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (const ::boost::weak_ptr<Y>& r): p_ (r) {} + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (const ::boost::shared_ptr<Y>& r): p_ (r) {} + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>& lazy_weak_ptr<T>:: + operator= (const ::boost::weak_ptr<Y>& r) + { + p_ = r; + i_.reset (); + return *this; + } + + template <class T> + template <class Y> + inline lazy_weak_ptr<T>& lazy_weak_ptr<T>:: + operator= (const ::boost::shared_ptr<Y>& r) + { + p_ = r; + i_.reset (); + return *this; + } + + template <class T> + inline bool lazy_weak_ptr<T>:: + loaded () const + { + bool i (i_); + return expired () != i; // expired () XOR i_ + } + + template <class T> + inline lazy_shared_ptr<T> lazy_weak_ptr<T>:: + lock () const + { + return lazy_shared_ptr<T> (p_.lock (), i_); + } + + template <class T> + inline ::boost::shared_ptr<T> lazy_weak_ptr<T>:: + load () const + { + ::boost::shared_ptr<T> r (p_.lock ()); + + if (!r && i_) + { + r = i_.template load<T> (false); // Keep id. + p_ = r; + } + + return r; + } + + template <class T> + inline void lazy_weak_ptr<T>:: + unload () const + { + // With weak pointer we always keep i_ up to date. + // + p_.reset (); + } + + template <class T> + inline ::boost::weak_ptr<T> lazy_weak_ptr<T>:: + get_eager () const + { + return p_; + } + + template <class T> + template <class DB, class ID> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (DB& db, const ID& id): i_ (db, id) {} + + template <class T> + template <class DB, class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (DB& db, const ::boost::shared_ptr<Y>& r) + : p_ (r) + { + typedef typename object_traits<T>::object_type object_type; + + if (r) + i_.reset (db, object_traits<object_type>::id (*r)); + } + + template <class T> + template <class DB, class Y> + inline lazy_weak_ptr<T>:: + lazy_weak_ptr (DB& db, const ::boost::weak_ptr<Y>& r) + : p_ (r) + { + typedef typename object_traits<T>::object_type object_type; + + ::boost::shared_ptr<T> sp (p_.lock ()); + + if (sp) + i_.reset (db, object_traits<object_type>::id (*sp)); + } + + template <class T> + template <class DB, class ID> + inline void lazy_weak_ptr<T>:: + reset (DB& db, const ID& id) + { + p_.reset (); + i_.reset (db, id); + } + + template <class T> + template <class DB, class Y> + inline void lazy_weak_ptr<T>:: + reset (DB& db, const ::boost::shared_ptr<Y>& r) + { + typedef typename object_traits<T>::object_type object_type; + + p_ = r; + + if (r) + i_.reset (db, object_traits<object_type>::id (*r)); + else + i_.reset (); + } + + template <class T> + template <class DB, class Y> + inline void lazy_weak_ptr<T>:: + reset (DB& db, const ::boost::weak_ptr<Y>& r) + { + typedef typename object_traits<T>::object_type object_type; + + p_ = r; + ::boost::shared_ptr<T> sp (p_.lock ()); + + if (sp) + i_.reset (db, object_traits<object_type>::id (*sp)); + else + i_.reset (); + } + + template <class T> + template <class O> + inline typename object_traits<O>::id_type lazy_weak_ptr<T>:: + object_id () const + { + typedef typename object_traits<T>::object_type object_type; + + ::boost::shared_ptr<T> sp (p_.lock ()); + return sp + ? object_traits<object_type>::id (*sp) + : i_.template object_id<O> (); + } + + template <class T> + inline typename lazy_weak_ptr<T>::database_type& lazy_weak_ptr<T>:: + database () const + { + return *i_.database (); + } + + template<class T> + inline void + swap (lazy_weak_ptr<T>& a, lazy_weak_ptr<T>& b) + { + a.swap (b); + } + } +} diff --git a/libodb-boost/odb/boost/smart-ptr/lazy-ptr.txx b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.txx new file mode 100644 index 0000000..c0cebd9 --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/lazy-ptr.txx @@ -0,0 +1,43 @@ +// file : odb/boost/smart-ptr/lazy-ptr.txx +// license : GNU GPL v2; see accompanying LICENSE file + +namespace odb +{ + namespace boost + { + // + // lazy_shared_ptr + // + + template <class T> + template <class Y> + bool lazy_shared_ptr<T>:: + equal (const lazy_shared_ptr<Y>& r) const + { + bool t1 (!p_ == loaded ()); + bool t2 (!r.p_ == r.loaded ()); + + // If both are transient, then compare the underlying pointers. + // + if (t1 && t2) + return p_ == r.p_; + + // If one is transient and the other is persistent, then compare + // the underlying pointers but only if they are non NULL. Note + // that an unloaded persistent object is always unequal to a + // transient object. + // + if (t1 || t2) + return p_ == r.p_ && p_; + + // If both objects are persistent, then we compare databases and + // object ids. + // + typedef typename object_traits<T>::object_type object_type1; + typedef typename object_traits<Y>::object_type object_type2; + + return i_.database () == r.i_.database () && + object_id<object_type1> () == r.template object_id<object_type2> (); + } + } +} diff --git a/libodb-boost/odb/boost/smart-ptr/pointer-traits.hxx b/libodb-boost/odb/boost/smart-ptr/pointer-traits.hxx new file mode 100644 index 0000000..8882822 --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/pointer-traits.hxx @@ -0,0 +1,110 @@ +// file : odb/boost/smart-ptr/pointer-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_SMART_PTR_POINTER_TRAITS_HXX +#define ODB_BOOST_SMART_PTR_POINTER_TRAITS_HXX + +#include <odb/pre.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + +#include <odb/pointer-traits.hxx> +#include <odb/details/meta/remove-const.hxx> + +namespace odb +{ + // Specialization for boost::shared_ptr. + // + template <typename T> + class pointer_traits< ::boost::shared_ptr<T> > + { + public: + static const pointer_kind kind = pk_shared; + static const bool lazy = false; + + typedef T element_type; + typedef ::boost::shared_ptr<element_type> pointer_type; + typedef ::boost::shared_ptr<const element_type> const_pointer_type; + typedef typename odb::details::meta::remove_const<element_type>::result + unrestricted_element_type; + typedef ::boost::shared_ptr<unrestricted_element_type> + unrestricted_pointer_type; + typedef smart_ptr_guard<pointer_type> guard; + + static element_type* + get_ptr (const pointer_type& p) + { + return p.get (); + } + + static element_type& + get_ref (const pointer_type& p) + { + return *p; + } + + static bool + null_ptr (const pointer_type& p) + { + return !p; + } + + static unrestricted_pointer_type + const_pointer_cast (const pointer_type& p) + { + return ::boost::const_pointer_cast<unrestricted_element_type> (p); + } + + template <typename T1> + static ::boost::shared_ptr<T1> + static_pointer_cast (const pointer_type& p) + { + return ::boost::static_pointer_cast<T1> (p); + } + + template <typename T1> + static ::boost::shared_ptr<T1> + dynamic_pointer_cast (const pointer_type& p) + { + return ::boost::dynamic_pointer_cast<T1> (p); + } + + public: + static void* + allocate (std::size_t n) + { + return operator new (n); + } + + static void + free (void* p) + { + operator delete (p); + } + }; + + // Specialization for boost::weak_ptr. + // + template <typename T> + class pointer_traits< ::boost::weak_ptr<T> > + { + public: + static const pointer_kind kind = pk_weak; + static const bool lazy = false; + + typedef T element_type; + typedef ::boost::weak_ptr<element_type> pointer_type; + typedef ::boost::shared_ptr<element_type> strong_pointer_type; + + static strong_pointer_type + lock (const pointer_type& p) + { + return p.lock (); + } + }; +} + +#include <odb/post.hxx> + +#endif // ODB_BOOST_SMART_PTR_POINTER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/smart-ptr/wrapper-traits.hxx b/libodb-boost/odb/boost/smart-ptr/wrapper-traits.hxx new file mode 100644 index 0000000..bc3229d --- /dev/null +++ b/libodb-boost/odb/boost/smart-ptr/wrapper-traits.hxx @@ -0,0 +1,64 @@ +// file : odb/boost/smart-ptr/wrapper-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_SMART_PTR_WRAPPER_TRAITS_HXX +#define ODB_BOOST_SMART_PTR_WRAPPER_TRAITS_HXX + +#include <odb/pre.hxx> + +#include <boost/shared_ptr.hpp> + +#include <odb/wrapper-traits.hxx> + +namespace odb +{ + // Specialization for boost::shared_ptr. + // + template <typename T> + class wrapper_traits< ::boost::shared_ptr<T> > + { + public: + typedef T wrapped_type; + typedef ::boost::shared_ptr<T> wrapper_type; + + // T can be const. + // + typedef + typename odb::details::meta::remove_const<T>::result + unrestricted_wrapped_type; + + static const bool null_handler = true; + static const bool null_default = false; + + static bool + get_null (const wrapper_type& p) + { + return !p; + } + + static void + set_null (wrapper_type& p) + { + p.reset (); + } + + static const wrapped_type& + get_ref (const wrapper_type& p) + { + return *p; + } + + static unrestricted_wrapped_type& + set_ref (wrapper_type& p) + { + if (!p) + p.reset (new unrestricted_wrapped_type); + + return const_cast<unrestricted_wrapped_type&> (*p); + } + }; +} + +#include <odb/post.hxx> + +#endif // ODB_BOOST_SMART_PTR_WRAPPER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/unordered.options b/libodb-boost/odb/boost/unordered.options new file mode 100644 index 0000000..56ee6c7 --- /dev/null +++ b/libodb-boost/odb/boost/unordered.options @@ -0,0 +1,7 @@ +# file : odb/boost/unordered.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/version + +--odb-epilogue '#include <odb/boost/unordered/container-traits.hxx>' +--hxx-prologue '#include <odb/boost/unordered/container-traits.hxx>' diff --git a/libodb-boost/odb/boost/unordered/container-traits.hxx b/libodb-boost/odb/boost/unordered/container-traits.hxx new file mode 100644 index 0000000..7814971 --- /dev/null +++ b/libodb-boost/odb/boost/unordered/container-traits.hxx @@ -0,0 +1,275 @@ +// file : odb/boost/unordered/container-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX +#define ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX + +#include <boost/version.hpp> + +// Unordered containers are available since 1.36.0. +// +#if BOOST_VERSION >= 103600 + +#include <odb/pre.hxx> + +#include <utility> // std::move + +#include <boost/unordered_set.hpp> +#include <boost/unordered_map.hpp> + +#include <odb/container-traits.hxx> +#include <odb/details/config.hxx> // ODB_CXX11 + +namespace odb +{ + // unordered_set + // + template <typename V, typename H, typename P, typename A> + class access::container_traits< ::boost::unordered_set<V, H, P, A> > + { + public: + static const container_kind kind = ck_set; + static const bool smart = false; + + typedef ::boost::unordered_set<V, H, P, A> container_type; + typedef V value_type; + + typedef set_functions<value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + load (container_type& c, bool more, const functions& f) + { + c.clear (); + + while (more) + { + value_type v; + more = f.select (v); +#ifdef ODB_CXX11 + c.insert (std::move (v)); +#else + c.insert (v); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; + + // unordered_multiset + // + // @@ Does multiset preserve insertion order of equal elements? The + // current implementation in the generated code does not guarantee + // this. + // + template <typename V, typename H, typename P, typename A> + class access::container_traits< ::boost::unordered_multiset<V, H, P, A> > + { + public: + static const container_kind kind = ck_multiset; + static const bool smart = false; + + typedef ::boost::unordered_multiset<V, H, P, A> container_type; + typedef V value_type; + + typedef set_functions<value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + load (container_type& c, bool more, const functions& f) + { + c.clear (); + + while (more) + { + value_type v; + more = f.select (v); +#ifdef ODB_CXX11 + c.insert (std::move (v)); +#else + c.insert (v); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (*i); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; + + // unordered_map + // + template <typename K, typename V, typename H, typename P, typename A> + class access::container_traits< ::boost::unordered_map<K, V, H, P, A> > + { + public: + static const container_kind kind = ck_map; + static const bool smart = false; + + typedef ::boost::unordered_map<K, V, H, P, A> container_type; + + typedef K key_type; + typedef V value_type; + typedef typename container_type::value_type pair_type; + + typedef map_functions<key_type, value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (i->first, i->second); + } + + static void + load (container_type& c, bool more, const functions& f) + { + c.clear (); + + while (more) + { + key_type k; + value_type v; + more = f.select (k, v); + +#ifdef ODB_CXX11 + c.insert (pair_type (std::move (k), std::move (v))); +#else + c.insert (pair_type (k, v)); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (i->first, i->second); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; + + // unordered_multimap + // + // @@ Does multimap preserve insertion order of equal elements? The + // current implementation in the generated code does not guarantee + // this. + // + template <typename K, typename V, typename H, typename P, typename A> + class access::container_traits< ::boost::unordered_multimap<K, V, H, P, A> > + { + public: + static const container_kind kind = ck_multimap; + static const bool smart = false; + + typedef ::boost::unordered_multimap<K, V, H, P, A> container_type; + + typedef K key_type; + typedef V value_type; + typedef typename container_type::value_type pair_type; + + typedef map_functions<key_type, value_type> functions; + + public: + static void + persist (const container_type& c, const functions& f) + { + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (i->first, i->second); + } + + static void + load (container_type& c, bool more, const functions& f) + { + c.clear (); + + while (more) + { + key_type k; + value_type v; + more = f.select (k, v); + +#ifdef ODB_CXX11 + c.insert (pair_type (std::move (k), std::move (v))); +#else + c.insert (pair_type (k, v)); +#endif + } + } + + static void + update (const container_type& c, const functions& f) + { + f.delete_ (); + + for (typename container_type::const_iterator i (c.begin ()), + e (c.end ()); i != e; ++i) + f.insert (i->first, i->second); + } + + static void + erase (const functions& f) + { + f.delete_ (); + } + }; +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid.options b/libodb-boost/odb/boost/uuid.options new file mode 100644 index 0000000..8b77aa6 --- /dev/null +++ b/libodb-boost/odb/boost/uuid.options @@ -0,0 +1,4 @@ +# file : odb/boost/uuid.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/uuid/uuid diff --git a/libodb-boost/odb/boost/uuid/mssql/uuid-mapping.hxx b/libodb-boost/odb/boost/uuid/mssql/uuid-mapping.hxx new file mode 100644 index 0000000..8da4c7d --- /dev/null +++ b/libodb-boost/odb/boost/uuid/mssql/uuid-mapping.hxx @@ -0,0 +1,22 @@ +// file : odb/boost/uuid/mssql/uuid-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_MSSQL_UUID_MAPPING_HXX +#define ODB_BOOST_UUID_MSSQL_UUID_MAPPING_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <boost/uuid/uuid.hpp> + +// By default map boost::uuids::uuid to SQL Server UNIQUEIDENTIFIER and +// use NULL to represent nil UUIDs. If NULL is disabled (e.g., at the +// member level), then we store the nil UUID (i.e., all bytes are zero). +// +#pragma db value(boost::uuids::uuid) type("UNIQUEIDENTIFIER") null + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_MSSQL_UUID_MAPPING_HXX diff --git a/libodb-boost/odb/boost/uuid/mssql/uuid-traits.hxx b/libodb-boost/odb/boost/uuid/mssql/uuid-traits.hxx new file mode 100644 index 0000000..ead1d85 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/mssql/uuid-traits.hxx @@ -0,0 +1,65 @@ +// file : odb/boost/uuid/mssql/uuid-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_MSSQL_UUID_TRAITS_HXX +#define ODB_BOOST_UUID_MSSQL_UUID_TRAITS_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <odb/pre.hxx> + +#include <cstring> // std::memcpy, std::memset + +#include <boost/uuid/uuid.hpp> + +#include <odb/mssql/traits.hxx> + +namespace odb +{ + namespace mssql + { + template <> + class default_value_traits< ::boost::uuids::uuid, id_uniqueidentifier> + { + public: + typedef ::boost::uuids::uuid value_type; + typedef value_type query_type; + typedef uniqueidentifier image_type; + + static void + set_value (value_type& v, const uniqueidentifier& i, bool is_null) + { + if (!is_null) + std::memcpy (v.data, &i, 16); + else + std::memset (v.data, 0, 16); + } + + static void + set_image (uniqueidentifier& i, bool& is_null, const value_type& v) + { + // If we can, store nil as NULL. Otherwise, store it as a value. + // + is_null = is_null && v.is_nil (); + + if (!is_null) + std::memcpy (&i, v.data, 16); + } + }; + + template <> + struct default_type_traits< ::boost::uuids::uuid> + { + static const database_type_id db_type_id = id_uniqueidentifier; + }; + } +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_MSSQL_UUID_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid/mysql/uuid-mapping.hxx b/libodb-boost/odb/boost/uuid/mysql/uuid-mapping.hxx new file mode 100644 index 0000000..a1de637 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/mysql/uuid-mapping.hxx @@ -0,0 +1,22 @@ +// file : odb/boost/uuid/mysql/uuid-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_MYSQL_UUID_MAPPING_HXX +#define ODB_BOOST_UUID_MYSQL_UUID_MAPPING_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <boost/uuid/uuid.hpp> + +// By default map boost::uuids::uuid to MySQL BINARY(16) and use NULL to +// represent nil UUIDs. If NULL is disabled (e.g., at the member level), +// then we store the nil UUID (i.e., all bytes are zero). +// +#pragma db value(boost::uuids::uuid) type("BINARY(16)") null + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_MYSQL_UUID_MAPPING_HXX diff --git a/libodb-boost/odb/boost/uuid/mysql/uuid-traits.hxx b/libodb-boost/odb/boost/uuid/mysql/uuid-traits.hxx new file mode 100644 index 0000000..b2ce1b0 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/mysql/uuid-traits.hxx @@ -0,0 +1,81 @@ +// file : odb/boost/uuid/mysql/uuid-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_MYSQL_UUID_TRAITS_HXX +#define ODB_BOOST_UUID_MYSQL_UUID_TRAITS_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <odb/pre.hxx> + +#include <cstring> // std::memcpy, std::memset +#include <cassert> + +#include <boost/uuid/uuid.hpp> + +#include <odb/mysql/traits.hxx> + +namespace odb +{ + namespace mysql + { + template <> + struct default_value_traits< ::boost::uuids::uuid, id_blob> + { + typedef ::boost::uuids::uuid value_type; + typedef value_type query_type; + typedef details::buffer image_type; + + static void + set_value (value_type& v, + const details::buffer& b, + std::size_t n, + bool is_null) + { + if (!is_null) + { + assert (n == 16); + std::memcpy (v.data, b.data (), 16); + } + else + std::memset (v.data, 0, 16); + } + + static void + set_image (details::buffer& b, + std::size_t& n, + bool& is_null, + const value_type& v) + { + // If we can, store nil as NULL. Otherwise, store it as a value. + // + is_null = is_null && v.is_nil (); + + if (!is_null) + { + n = 16; + + if (n > b.capacity ()) + b.capacity (n); + + std::memcpy (b.data (), v.data, n); + } + } + }; + + template <> + struct default_type_traits< ::boost::uuids::uuid> + { + static const database_type_id db_type_id = id_blob; + }; + } +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_MYSQL_UUID_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid/oracle/uuid-mapping.hxx b/libodb-boost/odb/boost/uuid/oracle/uuid-mapping.hxx new file mode 100644 index 0000000..bd49122 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/oracle/uuid-mapping.hxx @@ -0,0 +1,22 @@ +// file : odb/boost/uuid/oracle/uuid-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_ORACLE_UUID_MAPPING_HXX +#define ODB_BOOST_UUID_ORACLE_UUID_MAPPING_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <boost/uuid/uuid.hpp> + +// By default map boost::uuids::uuid to Oracle RAW(16) and use NULL to +// represent nil UUIDs. If NULL is disabled (e.g., at the member level), +// then we store the nil UUID (i.e., all bytes are zero). +// +#pragma db value(boost::uuids::uuid) type("RAW(16)") null + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_ORACLE_UUID_MAPPING_HXX diff --git a/libodb-boost/odb/boost/uuid/oracle/uuid-traits.hxx b/libodb-boost/odb/boost/uuid/oracle/uuid-traits.hxx new file mode 100644 index 0000000..d1ced34 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/oracle/uuid-traits.hxx @@ -0,0 +1,77 @@ +// file : odb/boost/uuid/oracle/uuid-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_ORACLE_UUID_TRAITS_HXX +#define ODB_BOOST_UUID_ORACLE_UUID_TRAITS_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <odb/pre.hxx> + +#include <cstring> // std::memcpy, std::memset +#include <cassert> + +#include <boost/uuid/uuid.hpp> + +#include <odb/oracle/traits.hxx> + +namespace odb +{ + namespace oracle + { + template <> + struct default_value_traits< ::boost::uuids::uuid, id_raw> + { + public: + typedef ::boost::uuids::uuid value_type; + typedef value_type query_type; + typedef char* image_type; + + static void + set_value (value_type& v, const char* b, std::size_t n, bool is_null) + { + if (!is_null) + { + assert (n == 16); + std::memcpy (v.data, b, 16); + } + else + std::memset (v.data, 0, 16); + } + + static void + set_image (char* b, + std::size_t c, + std::size_t& n, + bool& is_null, + const value_type& v) + { + // If we can, store nil as NULL. Otherwise, store it as a value. + // + is_null = is_null && v.is_nil (); + + if (!is_null) + { + n = 16; + assert (c >= n); + std::memcpy (b, v.data, n); + } + } + }; + + template <> + struct default_type_traits< ::boost::uuids::uuid> + { + static const database_type_id db_type_id = id_raw; + }; + } +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_ORACLE_UUID_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid/pgsql/uuid-mapping.hxx b/libodb-boost/odb/boost/uuid/pgsql/uuid-mapping.hxx new file mode 100644 index 0000000..517dfa6 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/pgsql/uuid-mapping.hxx @@ -0,0 +1,22 @@ +// file : odb/boost/uuid/pgsql/uuid-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_PGSQL_UUID_MAPPING_HXX +#define ODB_BOOST_UUID_PGSQL_UUID_MAPPING_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <boost/uuid/uuid.hpp> + +// By default map boost::uuids::uuid to PostgreSQL UUID and use NULL to +// represent nil UUIDs. If NULL is disabled (e.g., at the member level), +// then we store the nil UUID (i.e., all bytes are zero). +// +#pragma db value(boost::uuids::uuid) type("UUID") null + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_PGSQL_UUID_MAPPING_HXX diff --git a/libodb-boost/odb/boost/uuid/pgsql/uuid-traits.hxx b/libodb-boost/odb/boost/uuid/pgsql/uuid-traits.hxx new file mode 100644 index 0000000..482ca0e --- /dev/null +++ b/libodb-boost/odb/boost/uuid/pgsql/uuid-traits.hxx @@ -0,0 +1,70 @@ +// file : odb/boost/uuid/pgsql/uuid-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_PGSQL_UUID_TRAITS_HXX +#define ODB_BOOST_UUID_PGSQL_UUID_TRAITS_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <odb/pre.hxx> + +#include <cstring> // std::memcpy, std::memset + +#include <boost/uuid/uuid.hpp> + +#include <odb/pgsql/traits.hxx> + +namespace odb +{ + namespace pgsql + { + template <> + class default_value_traits< ::boost::uuids::uuid, id_uuid> + { + public: + typedef ::boost::uuids::uuid value_type; + typedef value_type query_type; + typedef unsigned char* image_type; + + // PostgreSQL binary UUID representation is big-endian in the RFC 4122, + // section 4.1.2 order. Lucky for us, that also the representation used + // by Boost. + // + + static void + set_value (value_type& v, const unsigned char* i, bool is_null) + { + if (!is_null) + std::memcpy (v.data, i, 16); + else + std::memset (v.data, 0, 16); + } + + static void + set_image (unsigned char* i, bool& is_null, const value_type& v) + { + // If we can, store nil as NULL. Otherwise, store it as a value. + // + is_null = is_null && v.is_nil (); + + if (!is_null) + std::memcpy (i, v.data, 16); + } + }; + + template <> + struct default_type_traits< ::boost::uuids::uuid> + { + static const database_type_id db_type_id = id_uuid; + }; + } +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_PGSQL_UUID_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid/sqlite/uuid-mapping.hxx b/libodb-boost/odb/boost/uuid/sqlite/uuid-mapping.hxx new file mode 100644 index 0000000..3fe2b6e --- /dev/null +++ b/libodb-boost/odb/boost/uuid/sqlite/uuid-mapping.hxx @@ -0,0 +1,22 @@ +// file : odb/boost/uuid/sqlite/uuid-mapping.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_SQLITE_UUID_MAPPING_HXX +#define ODB_BOOST_UUID_SQLITE_UUID_MAPPING_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <boost/uuid/uuid.hpp> + +// By default map boost::uuids::uuid to SQLite BLOB and use NULL to +// represent nil UUIDs. If NULL is disabled (e.g., at the member level), +// then we store the nil UUID (i.e., all bytes are zero). +// +#pragma db value(boost::uuids::uuid) type("BLOB") null + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_SQLITE_UUID_MAPPING_HXX diff --git a/libodb-boost/odb/boost/uuid/sqlite/uuid-traits.hxx b/libodb-boost/odb/boost/uuid/sqlite/uuid-traits.hxx new file mode 100644 index 0000000..7a333c8 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/sqlite/uuid-traits.hxx @@ -0,0 +1,81 @@ +// file : odb/boost/uuid/sqlite/uuid-traits.hxx +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef ODB_BOOST_UUID_SQLITE_UUID_TRAITS_HXX +#define ODB_BOOST_UUID_SQLITE_UUID_TRAITS_HXX + +#include <boost/version.hpp> + +// UUID library is available since 1.42.0. +// +#if BOOST_VERSION >= 104200 + +#include <odb/pre.hxx> + +#include <cstring> // std::memcpy, std::memset +#include <cassert> + +#include <boost/uuid/uuid.hpp> + +#include <odb/sqlite/traits.hxx> + +namespace odb +{ + namespace sqlite + { + template <> + struct default_value_traits< ::boost::uuids::uuid, id_blob> + { + typedef ::boost::uuids::uuid value_type; + typedef value_type query_type; + typedef details::buffer image_type; + + static void + set_value (value_type& v, + const details::buffer& b, + std::size_t n, + bool is_null) + { + if (!is_null) + { + assert (n == 16); + std::memcpy (v.data, b.data (), 16); + } + else + std::memset (v.data, 0, 16); + } + + static void + set_image (details::buffer& b, + std::size_t& n, + bool& is_null, + const value_type& v) + { + // If we can, store nil as NULL. Otherwise, store it as a value. + // + is_null = is_null && v.is_nil (); + + if (!is_null) + { + n = 16; + + if (n > b.capacity ()) + b.capacity (n); + + std::memcpy (b.data (), v.data, n); + } + } + }; + + template <> + struct default_type_traits< ::boost::uuids::uuid> + { + static const database_type_id db_type_id = id_blob; + }; + } +} + +#include <odb/post.hxx> + +#endif // BOOST_VERSION +#endif // ODB_BOOST_UUID_SQLITE_UUID_TRAITS_HXX diff --git a/libodb-boost/odb/boost/uuid/uuid-common.options b/libodb-boost/odb/boost/uuid/uuid-common.options new file mode 100644 index 0000000..3d9fa50 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-common.options @@ -0,0 +1,4 @@ +# file : odb/boost/uuid/uuid-common.options +# license : GNU GPL v2; see accompanying LICENSE file + +--profile boost/version diff --git a/libodb-boost/odb/boost/uuid/uuid-mssql.options b/libodb-boost/odb/boost/uuid/uuid-mssql.options new file mode 100644 index 0000000..f6a8144 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-mssql.options @@ -0,0 +1,11 @@ +# file : odb/boost/uuid/uuid-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/uuid/mssql/uuid-mapping.hxx>' + +--hxx-prologue '#include <odb/boost/uuid/mssql/uuid-traits.hxx>' diff --git a/libodb-boost/odb/boost/uuid/uuid-mysql.options b/libodb-boost/odb/boost/uuid/uuid-mysql.options new file mode 100644 index 0000000..889a452 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-mysql.options @@ -0,0 +1,11 @@ +# file : odb/boost/uuid/uuid-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/uuid/mysql/uuid-mapping.hxx>' + +--hxx-prologue '#include <odb/boost/uuid/mysql/uuid-traits.hxx>' diff --git a/libodb-boost/odb/boost/uuid/uuid-oracle.options b/libodb-boost/odb/boost/uuid/uuid-oracle.options new file mode 100644 index 0000000..3022dbf --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-oracle.options @@ -0,0 +1,11 @@ +# file : odb/boost/uuid/uuid-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/uuid/oracle/uuid-mapping.hxx>' + +--hxx-prologue '#include <odb/boost/uuid/oracle/uuid-traits.hxx>' diff --git a/libodb-boost/odb/boost/uuid/uuid-pgsql.options b/libodb-boost/odb/boost/uuid/uuid-pgsql.options new file mode 100644 index 0000000..63268dc --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-pgsql.options @@ -0,0 +1,11 @@ +# file : odb/boost/uuid/uuid-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/uuid/pgsql/uuid-mapping.hxx>' + +--hxx-prologue '#include <odb/boost/uuid/pgsql/uuid-traits.hxx>' diff --git a/libodb-boost/odb/boost/uuid/uuid-sqlite.options b/libodb-boost/odb/boost/uuid/uuid-sqlite.options new file mode 100644 index 0000000..ea515e9 --- /dev/null +++ b/libodb-boost/odb/boost/uuid/uuid-sqlite.options @@ -0,0 +1,11 @@ +# file : odb/boost/uuid/uuid-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/uuid/sqlite/uuid-mapping.hxx>' + +--hxx-prologue '#include <odb/boost/uuid/sqlite/uuid-traits.hxx>' diff --git a/libodb-boost/odb/boost/version.hxx b/libodb-boost/odb/boost/version.hxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libodb-boost/odb/boost/version.hxx diff --git a/libodb-boost/odb/boost/version.hxx.in b/libodb-boost/odb/boost/version.hxx.in new file mode 100644 index 0000000..15aed4e --- /dev/null +++ b/libodb-boost/odb/boost/version.hxx.in @@ -0,0 +1,74 @@ +// file : odb/boost/version.hxx.in +// license : GNU GPL v2; see accompanying LICENSE file + +#ifndef LIBODB_BOOST_VERSION // Note: using the version macro itself. + +// New numeric version format is AAAAABBBBBCCCCCDDDE where: +// +// AAAAA - major version number +// BBBBB - minor version number +// CCCCC - bugfix version number +// DDD - alpha / beta (DDD + 500) version number +// E - final (0) / snapshot (1) +// +// When DDDE is not 0, 1 is subtracted from AAAAABBBBBCCCCC. For example: +// +// Version AAAAABBBBBCCCCCDDDE +// +// 0.1.0 0000000001000000000 +// 0.1.2 0000000001000020000 +// 1.2.3 0000100002000030000 +// 2.2.0-a.1 0000200001999990010 +// 3.0.0-b.2 0000299999999995020 +// 2.2.0-a.1.z 0000200001999990011 +// +#define LIBODB_BOOST_VERSION_FULL $libodb_boost.version.project_number$ULL +#define LIBODB_BOOST_VERSION_STR "$libodb_boost.version.project$" +#define LIBODB_BOOST_VERSION_ID "$libodb_boost.version.project_id$" + +#define LIBODB_BOOST_VERSION_MAJOR $libodb_boost.version.major$ +#define LIBODB_BOOST_VERSION_MINOR $libodb_boost.version.minor$ +#define LIBODB_BOOST_VERSION_PATCH $libodb_boost.version.patch$ + +#define LIBODB_BOOST_PRE_RELEASE $libodb_boost.version.pre_release$ + +#define LIBODB_BOOST_SNAPSHOT $libodb_boost.version.snapshot_sn$ULL +#define LIBODB_BOOST_SNAPSHOT_ID "$libodb_boost.version.snapshot_id$" + +#include <odb/version.hxx> + +$libodb.check(LIBODB_VERSION_FULL, LIBODB_SNAPSHOT)$ + +// Old/deprecated numeric version format is AABBCCDD where: +// +// AA - major version number +// BB - minor version number +// CC - bugfix version number +// DD - alpha / beta (DD + 50) version number +// +// When DD is not 00, 1 is subtracted from AABBCC. For example: +// +// Version AABBCCDD +// 2.0.0 02000000 +// 2.1.0 02010000 +// 2.1.1 02010100 +// 2.2.0.a1 02019901 +// 3.0.0.b2 02999952 +// + +// ODB Boost interface version: odb interface version plus the Boost interface +// version. +// +// NOTE: also hardcoded in *.options. +// +#define ODB_BOOST_VERSION 2047600 +#define ODB_BOOST_VERSION_STR "2.5.0-b.26" + +// libodb-boost version: odb interface version plus the bugfix version. Note +// that LIBODB_BOOST_VERSION is always greater or equal to ODB_BOOST_VERSION +// since if the Boost interface virsion is incremented then the bugfix version +// must be incremented as well. +// +#define LIBODB_BOOST_VERSION 2049976 + +#endif // LIBODB_BOOST_VERSION diff --git a/libodb-boost/odb/boost/version.options b/libodb-boost/odb/boost/version.options new file mode 100644 index 0000000..904dcc5 --- /dev/null +++ b/libodb-boost/odb/boost/version.options @@ -0,0 +1,12 @@ +# file : odb/boost/version.options +# license : GNU GPL v2; see accompanying LICENSE file + +# Make sure the options files as seen by the ODB compiler and header +# files as seen by the C++ compiler have the same Boost interface +# version. +# +--hxx-prologue '#include <odb/boost/version.hxx>' + +--hxx-prologue '#if ODB_BOOST_VERSION != 2047600 // 2.5.0-b.26' +--hxx-prologue '# error ODB and C++ compilers see different libodb-boost interface versions' +--hxx-prologue '#endif' |