diff options
Diffstat (limited to 'libodb-boost/odb/boost/uuid')
-rw-r--r-- | libodb-boost/odb/boost/uuid/mssql/uuid-mapping.hxx | 22 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/mssql/uuid-traits.hxx | 65 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/mysql/uuid-mapping.hxx | 22 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/mysql/uuid-traits.hxx | 81 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/oracle/uuid-mapping.hxx | 22 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/oracle/uuid-traits.hxx | 77 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/pgsql/uuid-mapping.hxx | 22 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/pgsql/uuid-traits.hxx | 70 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/sqlite/uuid-mapping.hxx | 22 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/sqlite/uuid-traits.hxx | 81 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-common.options | 4 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-mssql.options | 11 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-mysql.options | 11 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-oracle.options | 11 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-pgsql.options | 11 | ||||
-rw-r--r-- | libodb-boost/odb/boost/uuid/uuid-sqlite.options | 11 |
16 files changed, 543 insertions, 0 deletions
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>' |