From 6c0d1e2ad8e86cb4c728ae6462b10ef7a06ee5c6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 5 Sep 2012 11:59:26 +0200 Subject: Support for Boost uuid persistence New Boost sub-profile: uuid. New test: boost/common/uuid. Updated the boost example to use uuid as an object id. --- doc/manual.xhtml | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) (limited to 'doc') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index a1e0360..5b99359 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -720,6 +720,17 @@ for consistency. + + 19.6Uuid Library + + + + + + +
19.6.1MySQL Database Type Mapping
19.6.2SQLite Database Type Mapping
19.6.3PostgreSQL Database Type Mapping
19.6.4Oracle Database Type Mapping
19.6.5SQL Server Database Type Mapping
+ + @@ -17730,6 +17741,136 @@ class person posix_time::time_duration value out of this range will result in the value_out_of_range exception.

+

19.6 Uuid Library

+ +

The uuid sub-profile provides persistence support for the + uuid type from the Boost uuid library. To + enable only this profile, pass boost/uuid to the + --profile ODB compiler option.

+ +

By default a data member of the uuid type is mapped to a + database column with NULL enabled and nil uuid + instances are stored as NULL values. However, you can + change this behavior by declaring the data member NOT NULL + with the not_null pragma (Section + 12.4.6, "null/not_null"). In this + case, or if the data member is an object id, the implementation + will store nil uuid instances as zero UUID values + ({00000000-0000-0000-0000-000000000000}). For example:

+ +
+#pragma db object
+class object
+{
+  ...
+
+  boost::uuids::uuid x_; // Nil values stored as NULL.
+
+  #pragma db not_null
+  boost::uuids::uuid y_; // Nil values stored as zero.
+};
+  
+ +

19.6.1 MySQL Database Type Mapping

+ +

The following table summarizes the default mapping between the Boost + uuid type and the MySQL database type.

+ + + + + + + + + + + + + + +
Boost TypeMySQL TypeDefault NULL Semantics
boost::uuids::uuidBINARY(16)NULL
+ +

19.6.2 SQLite Database Type Mapping

+ +

The following table summarizes the default mapping between the Boost + uuid type and the SQLite database type.

+ + + + + + + + + + + + + + +
Boost TypeSQLite TypeDefault NULL Semantics
boost::uuids::uuidBLOBNULL
+ +

19.6.3 PostgreSQL Database Type Mapping

+ +

The following table summarizes the default mapping between the Boost + uuid type and the PostgreSQL database type.

+ + + + + + + + + + + + + + +
Boost TypePostgreSQL TypeDefault NULL Semantics
boost::uuids::uuidUUIDNULL
+ +

19.6.4 Oracle Database Type Mapping

+ +

The following table summarizes the default mapping between the Boost + uuid type and the Oracle database type.

+ + + + + + + + + + + + + + +
Boost TypeOracle TypeDefault NULL Semantics
boost::uuids::uuidRAW(16)NULL
+ +

19.6.5 SQL Server Database Type Mapping

+ +

The following table summarizes the default mapping between the Boost + uuid type and the SQL Server database type.

+ + + + + + + + + + + + + + +
Boost TypeSQL Server TypeDefault NULL Semantics
boost::uuids::uuidUNIQUEIDENTIFIERNULL
+ -- cgit v1.1