diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | doc/manual.xhtml | 141 |
2 files changed, 146 insertions, 0 deletions
@@ -44,6 +44,11 @@ Version 2.1.0 Index container (boost::multi_index_container). For more information, refer to Section 19.3, "Multi-Index Container Library" in the ODB manual. + * The Boost profile now provides persistence support for the Boost uuid type + (boost::uuids::uuid). For more information, refer to Section 19.6, "Uuid + Library" in the ODB manual as well as the 'boost' example in the + odb-examples package. + * New pragma, definition, allows the specification of an alternative code generation location for persistent classes, views, and composite value types. This mechanism is primarily useful for converting third-party 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. </table> </td> </tr> + <tr> + <th>19.6</th><td><a href="#19.6">Uuid Library</a> + <table class="toc"> + <tr><th>19.6.1</th><td><a href="#19.6.1">MySQL Database Type Mapping</a></td></tr> + <tr><th>19.6.2</th><td><a href="#19.6.2">SQLite Database Type Mapping</a></td></tr> + <tr><th>19.6.3</th><td><a href="#19.6.3">PostgreSQL Database Type Mapping</a></td></tr> + <tr><th>19.6.4</th><td><a href="#19.6.4">Oracle Database Type Mapping</a></td></tr> + <tr><th>19.6.5</th><td><a href="#19.6.5">SQL Server Database Type Mapping</a></td></tr> + </table> + </td> + </tr> </table> </td> </tr> @@ -17730,6 +17741,136 @@ class person <code>posix_time::time_duration</code> value out of this range will result in the <code>value_out_of_range</code> exception.</p> + <h2><a name="19.6">19.6 Uuid Library</a></h2> + + <p>The <code>uuid</code> sub-profile provides persistence support for the + <code>uuid</code> type from the Boost <code>uuid</code> library. To + enable only this profile, pass <code>boost/uuid</code> to the + <code>--profile</code> ODB compiler option.</p> + + <p>By default a data member of the <code>uuid</code> type is mapped to a + database column with <code>NULL</code> enabled and nil <code>uuid</code> + instances are stored as <code>NULL</code> values. However, you can + change this behavior by declaring the data member <code>NOT NULL</code> + with the <code>not_null</code> pragma (<a href="#12.4.6">Section + 12.4.6, "<code>null</code>/<code>not_null</code>"</a>). In this + case, or if the data member is an object id, the implementation + will store nil <code>uuid</code> instances as zero UUID values + (<code>{00000000-0000-0000-0000-000000000000}</code>). For example:</p> + + <pre class="cxx"> +#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. +}; + </pre> + + <h3><a name="19.6.1">19.6.1 MySQL Database Type Mapping</a></h3> + + <p>The following table summarizes the default mapping between the Boost + <code>uuid</code> type and the MySQL database type.</p> + + <!-- border="1" is necessary for html2ps --> + <table id="mapping" border="1"> + <tr> + <th>Boost Type</th> + <th>MySQL Type</th> + <th>Default <code>NULL</code> Semantics</th> + </tr> + + <tr> + <td><code>boost::uuids::uuid</code></td> + <td><code>BINARY(16)</code></td> + <td><code>NULL</code></td> + </tr> + </table> + + <h3><a name="19.6.2">19.6.2 SQLite Database Type Mapping</a></h3> + + <p>The following table summarizes the default mapping between the Boost + <code>uuid</code> type and the SQLite database type.</p> + + <!-- border="1" is necessary for html2ps --> + <table id="mapping" border="1"> + <tr> + <th>Boost Type</th> + <th>SQLite Type</th> + <th>Default <code>NULL</code> Semantics</th> + </tr> + + <tr> + <td><code>boost::uuids::uuid</code></td> + <td><code>BLOB</code></td> + <td><code>NULL</code></td> + </tr> + </table> + + <h3><a name="19.6.3">19.6.3 PostgreSQL Database Type Mapping</a></h3> + + <p>The following table summarizes the default mapping between the Boost + <code>uuid</code> type and the PostgreSQL database type.</p> + + <!-- border="1" is necessary for html2ps --> + <table id="mapping" border="1"> + <tr> + <th>Boost Type</th> + <th>PostgreSQL Type</th> + <th>Default <code>NULL</code> Semantics</th> + </tr> + + <tr> + <td><code>boost::uuids::uuid</code></td> + <td><code>UUID</code></td> + <td><code>NULL</code></td> + </tr> + </table> + + <h3><a name="19.6.4">19.6.4 Oracle Database Type Mapping</a></h3> + + <p>The following table summarizes the default mapping between the Boost + <code>uuid</code> type and the Oracle database type.</p> + + <!-- border="1" is necessary for html2ps --> + <table id="mapping" border="1"> + <tr> + <th>Boost Type</th> + <th>Oracle Type</th> + <th>Default <code>NULL</code> Semantics</th> + </tr> + + <tr> + <td><code>boost::uuids::uuid</code></td> + <td><code>RAW(16)</code></td> + <td><code>NULL</code></td> + </tr> + </table> + + <h3><a name="19.6.5">19.6.5 SQL Server Database Type Mapping</a></h3> + + <p>The following table summarizes the default mapping between the Boost + <code>uuid</code> type and the SQL Server database type.</p> + + <!-- border="1" is necessary for html2ps --> + <table id="mapping" border="1"> + <tr> + <th>Boost Type</th> + <th>SQL Server Type</th> + <th>Default <code>NULL</code> Semantics</th> + </tr> + + <tr> + <td><code>boost::uuids::uuid</code></td> + <td><code>UNIQUEIDENTIFIER</code></td> + <td><code>NULL</code></td> + </tr> + </table> + <!-- CHAPTER --> |