From da0ec4c568db40052a396a7fd9534378d093c245 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 5 Sep 2012 14:58:54 +0200 Subject: Support for Qt QUuid persistence This support was added to the basic sub-profile. New test: qt/common/basic. Updated the qt example to use QUuid as an object id. --- doc/manual.xhtml | 82 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 13 deletions(-) (limited to 'doc/manual.xhtml') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 5b99359..d2df974 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -13905,8 +13905,8 @@ class object -

SQLite represents NaN FLOAT values - as NULL values. As a result, columns of the +

SQLite represents the NaN FLOAT value + as a NULL value. As a result, columns of the float and double types are by default declared as NULL. However, you can override this by explicitly declaring them as NOT NULL with the @@ -15362,7 +15362,7 @@ class object

In Oracle empty VARCHAR2 and NVARCHAR2 - strings are represented as NULL values. As a result, + strings are represented as a NULL value. As a result, columns of the std::string type are by default declared as NULL except for primary key columns. However, you can override this by explicitly declaring them as NOT NULL @@ -17748,9 +17748,11 @@ class person 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 +

The manner in which these types are persisted is database system + dependent and is discussed in the sub-sections that follow. 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 + instances are stored as a NULL value. 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 @@ -17909,11 +17911,12 @@ class object qt/basic to the --profile ODB compiler option.

-

The currently supported basic types are QString and - QByteArray. The manner in which these types - are persisted is database system dependent and is discussed in the - sub-sections that follow. The example below shows how - QString may be used within a persistent object.

+

The currently supported basic types are QString, + QByteArray, and QUuid. The manner in + which these types are persisted is database system dependent + and is discussed in the sub-sections that follow. The example + below shows how QString may be used within a + persistent object.

 #pragma db object
@@ -17924,6 +17927,29 @@ class Person
 };
   
+

By default a data member of the QUuid type is mapped to a + database column with NULL enabled and null QUuid + instances are stored as a NULL value. 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 null QUuid instances as zero UUID values + ({00000000-0000-0000-0000-000000000000}). For example:

+ +
+#pragma db object
+class object
+{
+  ...
+
+  QUuid x_; // Null values stored as NULL.
+
+  #pragma db not_null
+  QUuid y_; // Null values stored as zero.
+};
+  
+

20.1.1 MySQL Database Type Mapping

The following table summarizes the default mapping between the currently @@ -17948,11 +17974,17 @@ class Person BLOB NULL + + + QUuid + BINARY(16) + NULL + -

Instances of the QString and QByteArray types - are stored as a NULL value if their isNull() member - function returns true.

+

Instances of the QString and QByteArray + types are stored as a NULL value if their isNull() + member function returns true.

Note also that the QString type is mapped differently depending on whether a member of this type @@ -18005,6 +18037,12 @@ class Person BLOB NULL + + + QUuid + BLOB + NULL +

Instances of the QString and QByteArray types @@ -18035,6 +18073,12 @@ class Person BYTEA NULL + + + QUuid + UUID + NULL +

Instances of the QString and QByteArray types @@ -18084,6 +18128,12 @@ class Person BLOB NULL + + + QUuid + RAW(16) + NULL +

Instances of the QString and QByteArray types @@ -18137,6 +18187,12 @@ class Person VARBINARY(max) NULL + + + QUuid + UNIQUEIDENTIFIER + NULL +

Instances of the QString and QByteArray types -- cgit v1.1