aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-27 13:32:45 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-27 13:32:45 +0200
commitf8b3ee6d42f5112c4e66a07cc7fdba43ce66aacd (patch)
tree2f3d877c7174e345514fe01cf9e462c1cb18b7ac /doc
parent15b1a95942518c84f8161c59820ea5d0e49a4e54 (diff)
Support for NULL value semantics for composite values
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.xhtml32
1 files changed, 23 insertions, 9 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index dd7c649..c32cc37 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -6326,7 +6326,7 @@ CREATE TABLE person_nickname (
"<code>null</code>/<code>not_null</code>"</a>).</p>
<p>To properly support the <code>NULL</code> semantics, the
- C++ value type must have a notion or a <code>NULL</code>
+ C++ value type must have a notion of a <code>NULL</code>
value or a similar special state concept. Most basic
C++ types, such as <code>int</code> or <code>std::string</code>,
do not have this notion and therefore cannot be used directly
@@ -6481,18 +6481,17 @@ class person
Qt), provide support for smart pointers found in these frameworks
and libraries (<a href="#III">Part III, "Profiles"</a>).</p>
- <p>Currently, ODB supports the <code>NULL</code> semantics only
- for simple values. In future versions this support will be extended
- to composite values and containers. With this limitation in mind,
- we can still use smart pointers in data members of composite value
- and container types. The only restriction is that these pointers
- must not be <code>NULL</code>. For example:</p>
+ <p>ODB also supports the <code>NULL</code> semantics for composite
+ values. In the relational database the <code>NULL</code> composite
+ value is translated to <code>NULL</code> values for all the simple
+ data members of this composite value. For example:</p>
<pre class="c++">
#pragma db value
struct name
{
std::string first_;
+ odb::nullable&lt;std::string> middle_;
std::string last_;
};
@@ -6500,9 +6499,24 @@ struct name
class person
{
...
+ odb::nullable&lt;name> name_;
+};
+ </pre>
+
+ <p>ODB does not support the <code>NULL</code> semantics for containers.
+ This also means that a composite value that contains a container
+ cannot be <code>NULL</code>. With this limitation in mind, we can
+ still use smart pointers in data members of container types. The
+ only restriction is that these pointers must not be <code>NULL</code>.
+ For example:</p>
+
+ <pre class="c++">
+#pragma db object
+class person
+{
+ ...
- std::auto_ptr&lt;name> name_;
- std::auto_ptr&lt;std::vector&lt;name> > aliases_;
+ std::auto_ptr&lt;std::vector&lt;std::string> > aliases_;
};
</pre>