aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-26 15:54:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-26 15:54:21 +0200
commitd9e5bead995338786bcd0a5a3b684c9b06e7e3db (patch)
tree9408af8dc4496c5ab496d38d9781bd9512606696
parent84d9c3f57c35cf9e99e89eeeb6cc4f1c52c3f5a2 (diff)
Add chapter on object inheritance, document abstract pragma
-rw-r--r--doc/manual.xhtml746
1 files changed, 517 insertions, 229 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index 4242618..930d93f 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -389,71 +389,81 @@ for consistency.
</tr>
<tr>
- <th>8</th><td><a href="#8">Session</a>
+ <th>8</th><td><a href="#8">Inheritance</a>
<table class="toc">
- <tr><th>8.1</th><td><a href="#8.1">Object Cache</a></td></tr>
+ <tr><th>8.1</th><td><a href="#8.1">Reuse Inheritance</a></td></tr>
+ <tr><th>8.2</th><td><a href="#8.2">Polymorphism Inheritance</a></td></tr>
</table>
</td>
</tr>
<tr>
- <th>9</th><td><a href="#9">ODB Pragma Language</a>
+ <th>9</th><td><a href="#9">Session</a>
+ <table class="toc">
+ <tr><th>9.1</th><td><a href="#9.1">Object Cache</a></td></tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <th>10</th><td><a href="#10">ODB Pragma Language</a>
<table class="toc">
<tr>
- <th>9.1</th><td><a href="#9.1">Object Type Pragmas</a>
+ <th>10.1</th><td><a href="#10.1">Object Type Pragmas</a>
<table class="toc">
- <tr><th>9.1.1</th><td><a href="#9.1.1"><code>table</code></a></td></tr>
- <tr><th>9.1.2</th><td><a href="#9.1.2"><code>pointer</code></a></td></tr>
+ <tr><th>10.1.1</th><td><a href="#10.1.1"><code>table</code></a></td></tr>
+ <tr><th>10.1.2</th><td><a href="#10.1.2"><code>pointer</code></a></td></tr>
+ <tr><th>10.1.3</th><td><a href="#10.1.3"><code>abstract</code></a></td></tr>
</table>
</td>
</tr>
<tr>
- <th>9.2</th><td><a href="#9.2">Value Type Pragmas</a>
+ <th>10.2</th><td><a href="#10.2">Value Type Pragmas</a>
<table class="toc">
- <tr><th>9.2.1</th><td><a href="#9.2.1"><code>type</code></a></td></tr>
- <tr><th>9.2.2</th><td><a href="#9.2.2"><code>id_type</code></a></td></tr>
- <tr><th>9.2.3</th><td><a href="#9.2.3"><code>not_null</code></a></td></tr>
- <tr><th>9.2.4</th><td><a href="#9.2.4"><code>unordered</code></a></td></tr>
- <tr><th>9.2.5</th><td><a href="#9.2.5"><code>index_type</code></a></td></tr>
- <tr><th>9.2.6</th><td><a href="#9.2.6"><code>key_type</code></a></td></tr>
- <tr><th>9.2.7</th><td><a href="#9.2.7"><code>value_type</code></a></td></tr>
- <tr><th>9.2.8</th><td><a href="#9.2.8"><code>id_column</code></a></td></tr>
- <tr><th>9.2.9</th><td><a href="#9.2.9"><code>index_column</code></a></td></tr>
- <tr><th>9.2.10</th><td><a href="#9.2.10"><code>key_column</code></a></td></tr>
- <tr><th>9.2.11</th><td><a href="#9.2.11"><code>value_column</code></a></td></tr>
+ <tr><th>10.2.1</th><td><a href="#10.2.1"><code>type</code></a></td></tr>
+ <tr><th>10.2.2</th><td><a href="#10.2.2"><code>id_type</code></a></td></tr>
+ <tr><th>10.2.3</th><td><a href="#10.2.3"><code>not_null</code></a></td></tr>
+ <tr><th>10.2.4</th><td><a href="#10.2.4"><code>unordered</code></a></td></tr>
+ <tr><th>10.2.5</th><td><a href="#10.2.5"><code>index_type</code></a></td></tr>
+ <tr><th>10.2.6</th><td><a href="#10.2.6"><code>key_type</code></a></td></tr>
+ <tr><th>10.2.7</th><td><a href="#10.2.7"><code>value_type</code></a></td></tr>
+ <tr><th>10.2.8</th><td><a href="#10.2.8"><code>id_column</code></a></td></tr>
+ <tr><th>10.2.9</th><td><a href="#10.2.9"><code>index_column</code></a></td></tr>
+ <tr><th>10.2.10</th><td><a href="#10.2.10"><code>key_column</code></a></td></tr>
+ <tr><th>10.2.11</th><td><a href="#10.2.11"><code>value_column</code></a></td></tr>
</table>
</td>
</tr>
<tr>
- <th>9.3</th><td><a href="#9.3">Data Member Pragmas</a>
+ <th>10.3</th><td><a href="#10.3">Data Member Pragmas</a>
<table class="toc">
- <tr><th>9.3.1</th><td><a href="#9.3.1"><code>id</code></a></td></tr>
- <tr><th>9.3.2</th><td><a href="#9.3.2"><code>auto</code></a></td></tr>
- <tr><th>9.3.3</th><td><a href="#9.3.3"><code>type</code></a></td></tr>
- <tr><th>9.3.4</th><td><a href="#9.3.4"><code>column</code></a></td></tr>
- <tr><th>9.3.5</th><td><a href="#9.3.5"><code>transient</code></a></td></tr>
- <tr><th>9.3.6</th><td><a href="#9.3.6"><code>not_null</code></a></td></tr>
- <tr><th>9.3.7</th><td><a href="#9.3.7"><code>inverse</code></a></td></tr>
- <tr><th>9.3.8</th><td><a href="#9.3.8"><code>unordered</code></a></td></tr>
- <tr><th>9.3.9</th><td><a href="#9.3.9"><code>table</code></a></td></tr>
- <tr><th>9.3.10</th><td><a href="#9.3.10"><code>index_type</code></a></td></tr>
- <tr><th>9.3.11</th><td><a href="#9.3.11"><code>key_type</code></a></td></tr>
- <tr><th>9.3.12</th><td><a href="#9.3.12"><code>value_type</code></a></td></tr>
- <tr><th>9.3.13</th><td><a href="#9.3.13"><code>id_column</code></a></td></tr>
- <tr><th>9.3.14</th><td><a href="#9.3.14"><code>index_column</code></a></td></tr>
- <tr><th>9.3.15</th><td><a href="#9.3.15"><code>key_column</code></a></td></tr>
- <tr><th>9.3.16</th><td><a href="#9.3.16"><code>value_column</code></a></td></tr>
+ <tr><th>10.3.1</th><td><a href="#10.3.1"><code>id</code></a></td></tr>
+ <tr><th>10.3.2</th><td><a href="#10.3.2"><code>auto</code></a></td></tr>
+ <tr><th>10.3.3</th><td><a href="#10.3.3"><code>type</code></a></td></tr>
+ <tr><th>10.3.4</th><td><a href="#10.3.4"><code>column</code></a></td></tr>
+ <tr><th>10.3.5</th><td><a href="#10.3.5"><code>transient</code></a></td></tr>
+ <tr><th>10.3.6</th><td><a href="#10.3.6"><code>not_null</code></a></td></tr>
+ <tr><th>10.3.7</th><td><a href="#10.3.7"><code>inverse</code></a></td></tr>
+ <tr><th>10.3.8</th><td><a href="#10.3.8"><code>unordered</code></a></td></tr>
+ <tr><th>10.3.9</th><td><a href="#10.3.9"><code>table</code></a></td></tr>
+ <tr><th>10.3.10</th><td><a href="#10.3.10"><code>index_type</code></a></td></tr>
+ <tr><th>10.3.11</th><td><a href="#10.3.11"><code>key_type</code></a></td></tr>
+ <tr><th>10.3.12</th><td><a href="#10.3.12"><code>value_type</code></a></td></tr>
+ <tr><th>10.3.13</th><td><a href="#10.3.13"><code>id_column</code></a></td></tr>
+ <tr><th>10.3.14</th><td><a href="#10.3.14"><code>index_column</code></a></td></tr>
+ <tr><th>10.3.15</th><td><a href="#10.3.15"><code>key_column</code></a></td></tr>
+ <tr><th>10.3.16</th><td><a href="#10.3.16"><code>value_column</code></a></td></tr>
</table>
</td>
</tr>
<tr>
- <th>9.4</th><td><a href="#9.4">C++ Compiler Warnings</a>
+ <th>10.4</th><td><a href="#10.4">C++ Compiler Warnings</a>
<table class="toc">
- <tr><th>9.4.1</th><td><a href="#9.4.1">GNU C++</a></td></tr>
- <tr><th>9.4.2</th><td><a href="#9.4.2">Visual C++</a></td></tr>
- <tr><th>9.4.3</th><td><a href="#9.4.3">Sun C++</a></td></tr>
- <tr><th>9.4.4</th><td><a href="#9.4.4">IBM XL C++</a></td></tr>
- <tr><th>9.4.5</th><td><a href="#9.4.5">HP aC++</a></td></tr>
+ <tr><th>10.4.1</th><td><a href="#10.4.1">GNU C++</a></td></tr>
+ <tr><th>10.4.2</th><td><a href="#10.4.2">Visual C++</a></td></tr>
+ <tr><th>10.4.3</th><td><a href="#10.4.3">Sun C++</a></td></tr>
+ <tr><th>10.4.4</th><td><a href="#10.4.4">IBM XL C++</a></td></tr>
+ <tr><th>10.4.5</th><td><a href="#10.4.5">HP aC++</a></td></tr>
</table>
</td>
</tr>
@@ -466,30 +476,30 @@ for consistency.
</tr>
<tr>
- <th>10</th><td><a href="#10">MySQL Database</a>
+ <th>11</th><td><a href="#11">MySQL Database</a>
<table class="toc">
- <tr><th>10.1</th><td><a href="#10.1">MySQL Type Mapping</a></td></tr>
- <tr><th>10.2</th><td><a href="#10.2">MySQL Database Class</a></td></tr>
- <tr><th>10.3</th><td><a href="#10.3">MySQL Connection Factory</a></td></tr>
- <tr><th>10.4</th><td><a href="#10.4">MySQL Exceptions</a></td></tr>
+ <tr><th>11.1</th><td><a href="#11.1">MySQL Type Mapping</a></td></tr>
+ <tr><th>11.2</th><td><a href="#11.2">MySQL Database Class</a></td></tr>
+ <tr><th>11.3</th><td><a href="#11.3">MySQL Connection Factory</a></td></tr>
+ <tr><th>11.4</th><td><a href="#11.4">MySQL Exceptions</a></td></tr>
</table>
</td>
</tr>
<tr>
- <th>11</th><td><a href="#11">SQLite Database</a>
+ <th>12</th><td><a href="#12">SQLite Database</a>
<table class="toc">
- <tr><th>11.1</th><td><a href="#11.1">SQLite Type Mapping</a></td></tr>
- <tr><th>11.2</th><td><a href="#11.2">SQLite Database Class</a></td></tr>
- <tr><th>11.3</th><td><a href="#11.3">SQLite Connection Factory</a></td></tr>
- <tr><th>11.4</th><td><a href="#11.4">SQLite Exceptions</a></td></tr>
+ <tr><th>12.1</th><td><a href="#12.1">SQLite Type Mapping</a></td></tr>
+ <tr><th>12.2</th><td><a href="#12.2">SQLite Database Class</a></td></tr>
+ <tr><th>12.3</th><td><a href="#12.3">SQLite Connection Factory</a></td></tr>
+ <tr><th>12.4</th><td><a href="#12.4">SQLite Exceptions</a></td></tr>
<tr>
- <th>11.5</th><td><a href="#11.5">SQLite Limitations</a>
+ <th>12.5</th><td><a href="#12.5">SQLite Limitations</a>
<table class="toc">
- <tr><th>11.5.1</th><td><a href="#11.5.1">Query Result Caching</a></td></tr>
- <tr><th>11.5.2</th><td><a href="#11.5.2">Automatic Assignment of Object Ids</a></td></tr>
- <tr><th>11.5.3</th><td><a href="#11.5.3">Constraint Violations</a></td></tr>
- <tr><th>11.5.4</th><td><a href="#11.5.4">Sharing of Queries</a></td></tr>
+ <tr><th>12.5.1</th><td><a href="#12.5.1">Query Result Caching</a></td></tr>
+ <tr><th>12.5.2</th><td><a href="#12.5.2">Automatic Assignment of Object Ids</a></td></tr>
+ <tr><th>12.5.3</th><td><a href="#12.5.3">Constraint Violations</a></td></tr>
+ <tr><th>12.5.4</th><td><a href="#12.5.4">Sharing of Queries</a></td></tr>
</table>
</td>
</tr>
@@ -502,19 +512,19 @@ for consistency.
</tr>
<tr>
- <th>12</th><td><a href="#12">Profiles Introduction</a></td>
+ <th>13</th><td><a href="#13">Profiles Introduction</a></td>
</tr>
<tr>
- <th>13</th><td><a href="#13">Boost Profile</a>
+ <th>14</th><td><a href="#14">Boost Profile</a>
<table class="toc">
- <tr><th>13.1</th><td><a href="#13.1">Smart Pointers Library</a></td></tr>
- <tr><th>13.2</th><td><a href="#13.2">Unordered Containers Library</a></td></tr>
+ <tr><th>14.1</th><td><a href="#14.1">Smart Pointers Library</a></td></tr>
+ <tr><th>14.2</th><td><a href="#14.2">Unordered Containers Library</a></td></tr>
<tr>
- <th>13.3</th><td><a href="#13.3">Date Time Library</a>
+ <th>14.3</th><td><a href="#14.3">Date Time Library</a>
<table class="toc">
- <tr><th>13.3.1</th><td><a href="#13.3.1">MySQL Database Type Mapping</a></td></tr>
- <tr><th>13.3.2</th><td><a href="#13.3.2">SQLite Database Type Mapping</a></td></tr>
+ <tr><th>14.3.1</th><td><a href="#14.3.1">MySQL Database Type Mapping</a></td></tr>
+ <tr><th>14.3.2</th><td><a href="#14.3.2">SQLite Database Type Mapping</a></td></tr>
</table>
</td>
</tr>
@@ -523,23 +533,23 @@ for consistency.
</tr>
<tr>
- <th>14</th><td><a href="#14">Qt Profile</a>
+ <th>15</th><td><a href="#15">Qt Profile</a>
<table class="toc">
<tr>
- <th>14.1</th><td><a href="#14.1">Basic Types Library</a>
+ <th>15.1</th><td><a href="#15.1">Basic Types Library</a>
<table class="toc">
- <tr><th>14.1.1</th><td><a href="#14.1.1">MySQL Database Type Mapping</a></td></tr>
- <tr><th>14.1.2</th><td><a href="#14.1.2">SQLite Database Type Mapping</a></td></tr>
+ <tr><th>15.1.1</th><td><a href="#15.1.1">MySQL Database Type Mapping</a></td></tr>
+ <tr><th>15.1.2</th><td><a href="#15.1.2">SQLite Database Type Mapping</a></td></tr>
</table>
</td>
</tr>
- <tr><th>14.2</th><td><a href="#14.2">Smart Pointers Library</a></td></tr>
- <tr><th>14.3</th><td><a href="#14.3">Containers Library</a></td></tr>
+ <tr><th>15.2</th><td><a href="#15.2">Smart Pointers Library</a></td></tr>
+ <tr><th>15.3</th><td><a href="#15.3">Containers Library</a></td></tr>
<tr>
- <th>14.4</th><td><a href="#14.4">Date Time Library</a>
+ <th>15.4</th><td><a href="#15.4">Date Time Library</a>
<table class="toc">
- <tr><th>14.4.1</th><td><a href="#14.4.1">MySQL Database Type Mapping</a></td></tr>
- <tr><th>14.4.2</th><td><a href="#14.4.2">SQLite Database Type Mapping</a></td></tr>
+ <tr><th>15.4.1</th><td><a href="#15.4.1">MySQL Database Type Mapping</a></td></tr>
+ <tr><th>15.4.2</th><td><a href="#15.4.2">SQLite Database Type Mapping</a></td></tr>
</table>
</td>
</tr>
@@ -659,8 +669,9 @@ for consistency.
<tr><th>5</th><td><a href="#5">Containers</a></td></tr>
<tr><th>6</th><td><a href="#6">Relationships</a></td></tr>
<tr><th>7</th><td><a href="#7">Composite Value Types</a></td></tr>
- <tr><th>8</th><td><a href="#8">Session</a></td></tr>
- <tr><th>9</th><td><a href="#9">ODB Pragma Language</a></td></tr>
+ <tr><th>8</th><td><a href="#8">Inheritance</a></td></tr>
+ <tr><th>9</th><td><a href="#9">Session</a></td></tr>
+ <tr><th>10</th><td><a href="#10">ODB Pragma Language</a></td></tr>
</table>
@@ -1272,7 +1283,7 @@ main (int argc, char* argv[])
database name, etc., from the command line. In your own applications
you may prefer to use other <code>mysql::database</code>
constructors which allow you to pass this information directly
- (<a href="#10.2">Section 10.2, "MySQL Database Class"</a>).</p>
+ (<a href="#11.2">Section 11.2, "MySQL Database Class"</a>).</p>
<p>Next, we create three <code>person</code> objects. Right now they are
transient objects, which means that if we terminate the application
@@ -1825,7 +1836,7 @@ class person
<p>These two pragmas are the minimum required to declare a
persistent class. Other pragmas can be used to fine-tune
the database-related properties of a class and its
- members (<a href="#9">Chapter 9, "ODB Pragma Language"</a>).</p>
+ members (<a href="#10">Chapter 10, "ODB Pragma Language"</a>).</p>
<p>Normally, an object class should define the default constructor. The
generated database support code uses this constructor when
@@ -1871,7 +1882,7 @@ private:
mapping to the database system type and, possibly, the code to
convert between the two. For more information on how to achieve
this refer to the <code>db&nbsp;type</code> pragma description
- in <a href="#9.2.1">Section 9.2.1, "<code>type</code>"</a>. Similar
+ in <a href="#10.2.1">Section 10.2.1, "<code>type</code>"</a>. Similar
to object types, composite value types have to be explicitly declared
as persistent using the <code>db&nbsp;value</code> pragma, for example:</p>
@@ -1939,7 +1950,7 @@ class name
return pointers to these instances. As we will see in later chapters,
pointers are also used to establish relationships between objects
(<a href="#6">Chapter 6, Relationships</a>) as well as to cache
- persistent objects in a session (<a href="#8">Chapter 8, Session</a>).</p>
+ persistent objects in a session (<a href="#9">Chapter 9, Session</a>).</p>
<p>By default, all these mechanisms use raw pointers to return,
pass, and cache objects. This is normally sufficient for applications
@@ -1982,7 +1993,7 @@ class person
};
</pre>
- <p>Refer to <a href="#9.1.2">Section 9.1.2, "<code>pointer</code>"</a>
+ <p>Refer to <a href="#10.1.2">Section 10.1.2, "<code>pointer</code>"</a>
for more information on this pragma.</p>
<p>Built-in support that is provided by the ODB runtime library allows us
@@ -2106,7 +2117,7 @@ namespace odb
our application. To map persistent classes to custom database schemas, ODB
provides a wide range of mapping customization pragmas, such
as <code>db&nbsp;table</code>, <code>db&nbsp;column</code>,
- and <code>db&nbsp;type</code> (<a href="#9">Chapter 9, "ODB Pragma
+ and <code>db&nbsp;type</code> (<a href="#10">Chapter 10, "ODB Pragma
Language"</a>). For sample code that shows how to perform such mapping
for various C++ constructs, refer to the <code>schema/custom</code>
example in the <code>odb-examples</code> package.</p>
@@ -2395,7 +2406,7 @@ for (unsigned short retry_count (0); ; retry_count++)
<p>The first <code>persist()</code> function expects a constant reference
to an instance being persisted. The second function expects a constant
object pointer. Both of these functions can only be used on objects with
- application-assigned object ids (<a href="#9.3.2">Section 9.3.2,
+ application-assigned object ids (<a href="#10.3.2">Section 10.3.2,
"<code>auto</code>"</a>).</p>
<p>The second and third <code>persist()</code> functions are similar to the
@@ -2839,7 +2850,7 @@ namespace odb
<code>not_in_session</code>, and
<code>const_object</code>) are thrown by the
<code>odb::session</code> class and are discussed
- in <a href="#8">Chapter 8, "Session"</a>.</p>
+ in <a href="#9">Chapter 9, "Session"</a>.</p>
<p>The <code>recoverable</code> exception serves as a common base
for all the recoverable exceptions, which are: <code>connection_lost</code>,
@@ -3569,7 +3580,7 @@ private:
<p>A number of ODB pragmas allow us to customize the table name, column
names, and native database types of an ordered container both, on
the per-container and per-member basis. For more information on
- these pragmas, refer to <a href="#9">Chapter 9, "ODB Pragma
+ these pragmas, refer to <a href="#10">Chapter 10, "ODB Pragma
Language"</a>. The following example shows some of the possible
customizations:</p>
@@ -3595,8 +3606,8 @@ private:
the order information. In the example above, for instance, the order
of person's nicknames is probably not important. To instruct the ODB
compiler to ignore the order in ordered containers we can use the
- <code>db&nbsp;unordered</code> pragma (<a href="#9.2.4">Section 9.2.4,
- "<code>unordered</code>"</a>, <a href="#9.3.8">Section 9.3.8,
+ <code>db&nbsp;unordered</code> pragma (<a href="#10.2.4">Section 10.2.4,
+ "<code>unordered</code>"</a>, <a href="#10.3.8">Section 10.3.8,
"<code>unordered</code>"</a>). For example:</p>
<pre class="c++">
@@ -3657,7 +3668,7 @@ private:
<p>A number of ODB pragmas allow us to customize the table name,
column names, and native database types of a set container, both on
the per-container and per-member basis. For more information on
- these pragmas, refer to <a href="#9">Chapter 9, "ODB Pragma
+ these pragmas, refer to <a href="#10">Chapter 10, "ODB Pragma
Language"</a>. The following example shows some of the possible
customizations:</p>
@@ -3719,7 +3730,7 @@ private:
<p>A number of ODB pragmas allow us to customize the table name,
column names, and native database types of a map container, both on
the per-container and per-member basis. For more information on
- these pragmas, refer to <a href="#9">Chapter 9, "ODB Pragma
+ these pragmas, refer to <a href="#10">Chapter 10, "ODB Pragma
Language"</a>. The following example shows some of the possible
customizations:</p>
@@ -3907,7 +3918,7 @@ unsigned long john_id, jane_id;
<p>The only notable line in the above code is the creation of a
session before the second transaction starts. As discussed in
- <a href="#8">Chapter 8, "Session"</a>, a session acts as a cache
+ <a href="#9">Chapter 9, "Session"</a>, a session acts as a cache
of persistent objects.
By creating a session before loading the <code>employee</code>
objects we make sure that their <code>employer_</code> pointers
@@ -4075,7 +4086,7 @@ CREATE TABLE employee_projects (
<p>To obtain a more canonical database schema, the names of tables
and columns above can be customized using ODB pragmas
- (<a href="#9">Chapter 9, "ODB Pragma Language"</a>). For example:</p>
+ (<a href="#10">Chapter 10, "ODB Pragma Language"</a>). For example:</p>
<pre class="c++">
#pragma db object
@@ -4198,7 +4209,7 @@ CREATE TABLE employee (
of these references.</p>
<p>To eliminate redundant database schema references we can use the
- <code>inverse</code> pragma (<a href="#9.3.7">Section 9.3.7,
+ <code>inverse</code> pragma (<a href="#10.3.7">Section 10.3.7,
"<code>inverse</code>"</a>) which tells the ODB compiler that
a pointer is the inverse side of a bidirectional relationship.
Either side of a relationship can be made inverse. For example:</p>
@@ -4242,7 +4253,7 @@ CREATE TABLE employee (
pointer. Also note that an ordered container (<a href="#5.1">Section
5.1, "Ordered Containers"</a>) of pointers that is an inverse side
of a bidirectional relationship is always treated as unordered
- (<a href="#9.3.8">Section 9.3.8, "<code>unordered</code>"</a>)
+ (<a href="#10.3.8">Section 10.3.8, "<code>unordered</code>"</a>)
because the contents of such a container are implicitly built from
the direct side of the relationship which does not contain the
element order (index).</p>
@@ -4924,8 +4935,8 @@ t.commit ();
<p>Customizing a column name for a data member of a simple value
type is straightforward: we simply specify the desired name with
- the <code>db&nbsp;column</code> pragma (<a href="#9.3.4">Section
- 9.3.4, "<code>column</code>"</a>). For composite value
+ the <code>db&nbsp;column</code> pragma (<a href="#10.3.4">Section
+ 10.3.4, "<code>column</code>"</a>). For composite value
types things are slightly more complex since they are mapped to
multiple columns. Consider the following example:</p>
@@ -5026,9 +5037,9 @@ CREATE TABLE person (
<p>The same principle applies when a composite value type is used
as an element of a container, except that instead of
<code>db&nbsp;column</code>, either the <code>db&nbsp;value_column</code>
- (<a href="#9.3.16">Section 9.3.16, "<code>value_column</code>"</a>) or
+ (<a href="#10.3.16">Section 10.3.16, "<code>value_column</code>"</a>) or
<code>db&nbsp;key_column</code>
- (<a href="#9.3.15">Section 9.3.15, "<code>key_column</code>"</a>)
+ (<a href="#10.3.15">Section 10.3.15, "<code>key_column</code>"</a>)
pragmas are used to specify the column prefix.</p>
<p>When a composite value type contains a container, an extra table
@@ -5072,8 +5083,8 @@ CREATE TABLE person (
</pre>
<p>To customize the container table name we can use the
- <code>db&nbsp;table</code> pragma (<a href="#9.3.9">Section
- 9.3.9, "<code>table</code>"</a>), for example:</p>
+ <code>db&nbsp;table</code> pragma (<a href="#10.3.9">Section
+ 10.3.9, "<code>table</code>"</a>), for example:</p>
<pre class="c++">
#pragma db value
@@ -5111,7 +5122,246 @@ CREATE TABLE `person_nickname` (
<hr class="page-break"/>
- <h1><a name="8">8 Session</a></h1>
+ <h1><a name="8">8 Inheritance</a></h1>
+
+ <p>In C++ inheritance can be used to achieve two different goals.
+ We can employ inheritance to reuse common data and functionality
+ in multiple classes. For example:</p>
+
+ <pre class="c++">
+class person
+{
+public:
+ const std::string&amp;
+ first () const;
+
+ const std::string&amp;
+ last () const;
+
+private:
+ std::string first_;
+ std::string last_;
+};
+
+class employee: public person
+{
+ ...
+};
+
+class contractor: public person
+{
+ ...
+};
+</pre>
+
+ <p>In the above example both the <code>employee</code> and
+ <code>contractor</code> classes inherit the <code>first_</code>
+ and <code>last_</code> data members as well as the <code>first()</code>
+ and <code>last()</code> accessors from the <code>person</code> base
+ class.</p>
+
+ <p>A common trait of this inheritance style, referred to as <em>reuse
+ inheritance</em> from now on, is the lack of virtual functions and
+ a virtual destructor in the base class. Also with this style the
+ application code is normally written in terms of derived classes
+ instead of a base.</p>
+
+ <p>The second way to utilize inheritance in C++ is to provide polymorphic
+ behavior through a common interface. In this case the base class
+ defines a number of virtual functions and, normally, a virtual
+ destructor while the derived classes provide specific
+ implementations of these virtual functions. For example:</p>
+
+ <pre class="c++">
+class person
+{
+public:
+ enum employment_status
+ {
+ unemployed,
+ temporary,
+ permanent,
+ self_employed
+ };
+
+ virtual employment_status
+ employment () const = 0;
+
+ virtual
+ ~person ();
+};
+
+class employee: public person
+{
+public:
+ virtual employment_status
+ employment () const
+ {
+ return temporary_ ? temporary : permanent;
+ }
+
+private:
+ bool temporary_;
+};
+
+class contractor: public person
+{
+public:
+ virtual employment_status
+ employment () const
+ {
+ return self_employed;
+ }
+};
+</pre>
+
+ <p>With this inheritance style, which we will call <em>polymorphism
+ inheritance</em>, the application code normally works with derived
+ classes via the base class interface. Note also that it is very common
+ to mix both styles in the same hierarchy. For example, the above two
+ code fragments can be combined so that the <code>person</code> base
+ class provides the common data members and functions as well as
+ defines the polymorphic interface.</p>
+
+ <p>The following sections describe the available strategies for
+ mapping reuse and polymorphism inheritance styles to a relational
+ data model. Note also that the distinction between the two styles is
+ conceptual rather than formal. For example, it is possible to treat
+ a class hierarchy that defines virtual functions as a case of reuse
+ inheritance if this results in the desired database mapping and
+ semantics.</p>
+
+ <p>Generally, classes that employ reuse inheritance are mapped to
+ completely independent entities in the database. They use different
+ object id spaces and should always be passed to and returned from
+ the database operations as pointers or references to derived types.
+ In other words, from the persistence point of view, such classes
+ behave as if the data members from the base classes were copied
+ verbatim into the derived ones.</p>
+
+ <p>In contrast, classes that employ polymorphism inheritance share
+ the object id space and can be passed to and returned from the
+ database operations <em>polymorphically</em> as pointers or
+ references to the base class.</p>
+
+ <p>For both inheritance styles it is sometimes desirable to prevent
+ instances of a base class from being stored in the database.
+ To achieve this a persistent
+ class can be declared abstract using the <code>db&nbsp;abstract</code>
+ pragma (<a href="#10.1.3">Section 10.1.3, "<code>abstract</code>"</a>).
+ Note that a <em>C++-abstract</em> class, or a class that
+ has one or more pure virtual functions and therefore cannot be
+ instantiated, is also <em>database-abstract</em>. However, a
+ database-abstract class is not necessarily C++-abstract. The
+ ODB compiler automatically treats C++-abstract classes as
+ database-abstract.</p>
+
+ <h2><a name="8.1">8.1 Reuse Inheritance</a></h2>
+
+ <p>Each non-abstract class from the reuse inheritance hierarchy is
+ mapped to a separate database table that contains all its data
+ members, including those inherited from base classes. An abstract
+ persistent class does not have to define an object id, nor a default
+ constructor, and it does not have a corresponding database table.
+ An abstract class cannot be a pointed-to object in a relationship.
+ Multiple inheritance is supported as long as each base
+ class is only inherited once. The following example shows a
+ persistent class hierarchy employing reuse inheritance:</p>
+
+<pre class="c++">
+// Abstract person class. Note that it does not declare the
+// object id.
+//
+#pragma db object abstract
+class person
+{
+ ...
+
+ std::string first_;
+ std::string last_;
+};
+
+// Abstract employee class. It derives from the person class and
+// declares the object id for all the concrete employee types.
+//
+#pragma db object abstract
+class employee: public person
+{
+ ...
+
+ #pragma db id auto
+ unsigned long id_;
+};
+
+// Concrete permanent_employee class. Note that it doesn't define
+// any data members of its own.
+//
+#pragma db object
+class permanent_employee: public employee
+{
+ ...
+};
+
+// Concrete temporary_employee class. It adds the employment
+// duration in months.
+//
+#pragma db object
+class temporary_employee: public employee
+{
+ ...
+
+ unsigned long duration_;
+};
+
+// Concrete contractor class. It derives from the person class
+// (and not employee; an independent contractor is not considered
+// an employee). We use the contractor's external email address
+// as the object id.
+//
+#pragma db object
+class contractor: public person
+{
+ ...
+
+ #pragma db id
+ std::string email_;
+};
+</pre>
+
+ <p>The sample database schema for this hierarchy is shown below.</p>
+
+<pre class="sql">
+CREATE TABLE permanent_employee (
+ first TEXT NOT NULL,
+ last TEXT NOT NULL,
+ id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT);
+
+CREATE TABLE temporary_employee (
+ first TEXT NOT NULL,
+ last` TEXT NOT NULL,
+ id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ duration BIGINT UNSIGNED NOT NULL);
+
+CREATE TABLE contractor (
+ first TEXT NOT NULL,
+ last TEXT NOT NULL,
+ email VARCHAR (255) NOT NULL PRIMARY KEY);
+</pre>
+
+ <p>The complete version of the code presented in this section is
+ available in the <code>inheritance</code> example in the
+ <code>odb-examples</code> package.</p>
+
+ <h2><a name="8.2">8.2 Polymorphism Inheritance</a></h2>
+
+ <p>Polymorphism inheritance mapping is not yet implemented. Future
+ versions of ODB will add support for this functionality.</p>
+
+ <!-- CHAPTER -->
+
+
+ <hr class="page-break"/>
+ <h1><a name="9">9 Session</a></h1>
<p>A session is an application's unit of work that may encompass several
database transactions. In this version of ODB a session is just an
@@ -5233,7 +5483,7 @@ namespace odb
it could be useful in some cases, for example, to find out whether
an object has already been loaded.</p>
- <h2><a name="8.1">8.1 Object Cache</a></h2>
+ <h2><a name="9.1">9.1 Object Cache</a></h2>
<p>A session is an object cache. Every time an object is made persistent
by calling the <code>database::persist()</code> function
@@ -5301,7 +5551,7 @@ t.commit ();
<hr class="page-break"/>
- <h1><a name="9">9 ODB Pragma Language</a></h1>
+ <h1><a name="10">10 ODB Pragma Language</a></h1>
<p>As we have already seen in previous chapters, ODB uses a pragma-based
language to capture database-specific information about C++ types.
@@ -5464,10 +5714,10 @@ class person
the C++ compiler to build the application. Some C++ compilers
issue warnings about pragmas that they do not recognize. There
are several ways to deal with this problem which are covered
- at the end of this chapter in <a href="#9.4">Section 9.4,
+ at the end of this chapter in <a href="#10.4">Section 10.4,
"C++ Compiler Warnings"</a>.</p>
- <h2><a name="9.1">9.1 Object Type Pragmas</a></h2>
+ <h2><a name="10.1">10.1 Object Type Pragmas</a></h2>
<p>A pragma with the <code>object</code> qualifier declares a C++ class
as a persistent object type. The qualifier can be optionally followed,
@@ -5484,19 +5734,25 @@ class person
<tr>
<td><code>table</code></td>
<td>table name for a persistent class</td>
- <td><a href="#9.1.1">9.1.1</a></td>
+ <td><a href="#10.1.1">10.1.1</a></td>
</tr>
<tr>
<td><code>pointer</code></td>
<td>pointer type for a persistent class</td>
- <td><a href="#9.1.2">9.1.2</a></td>
+ <td><a href="#10.1.2">10.1.2</a></td>
+ </tr>
+
+ <tr>
+ <td><code>abstract</code></td>
+ <td>persistent class is abstract</td>
+ <td><a href="#10.1.3">10.1.3</a></td>
</tr>
</table>
- <h3><a name="9.1.1">9.1.1 <code>table</code></a></h3>
+ <h3><a name="10.1.1">10.1.1 <code>table</code></a></h3>
<p>The <code>table</code> specifier specifies the table name that should
be used to store objects of a class in a relational database. For
@@ -5513,7 +5769,7 @@ class person
<p>If the table name is not specified, the class name is used as the
table name.</p>
- <h3><a name="9.1.2">9.1.2 <code>pointer</code></a></h3>
+ <h3><a name="10.1.2">10.1.2 <code>pointer</code></a></h3>
<p>The <code>pointer</code> specifier specifies the object pointer type
for a persistent class. The object pointer type is used to return,
@@ -5563,7 +5819,39 @@ class person
<p>For a more detailed discussion of object pointers, refer to
<a href="#3.2">Section 3.2, "Object Pointers"</a>.</p>
- <h2><a name="9.2">9.2 Value Type Pragmas</a></h2>
+ <h3><a name="10.1.3">10.1.3 <code>abstract</code></a></h3>
+
+ <p>The <code>abstract</code> specifier specifies that a persistent class
+ is abstract. An instance of an abstract class cannot be stored in
+ the database and is normally used as a base for other persistent
+ classes. For example:</p>
+
+ <pre class="c++">
+#pragma db object abstract
+class person
+{
+ ...
+};
+
+#pragma db object
+class employee: public person
+{
+ ...
+};
+
+#pragma db object
+class contractor: public person
+{
+ ...
+};
+ </pre>
+
+ <p>Persistent classes with pure virtual functions are automatically
+ treated as abstract by the ODB compiler. For a more detailed
+ discussion of persistent class inheritance, refer to
+ <a href="#8">Chapter 8, "Inheritance"</a>.</p>
+
+ <h2><a name="10.2">10.2 Value Type Pragmas</a></h2>
<p>A pragma with the <code>value</code> qualifier describes a value
type. It can be optionally followed, in any order, by one or more
@@ -5580,73 +5868,73 @@ class person
<tr>
<td><code>type</code></td>
<td>database type for a value type</td>
- <td><a href="#9.2.1">9.2.1</a></td>
+ <td><a href="#10.2.1">10.2.1</a></td>
</tr>
<tr>
<td><code>id_type</code></td>
<td>database type for a value type when used as an object id</td>
- <td><a href="#9.2.2">9.2.2</a></td>
+ <td><a href="#10.2.2">10.2.2</a></td>
</tr>
<tr>
<td><code>not_null</code></td>
<td>object pointer cannot be <code>NULL</code></td>
- <td><a href="#9.2.3">9.2.3</a></td>
+ <td><a href="#10.2.3">10.2.3</a></td>
</tr>
<tr>
<td><code>unordered</code></td>
<td>ordered container should be stored unordered</td>
- <td><a href="#9.2.4">9.2.4</a></td>
+ <td><a href="#10.2.4">10.2.4</a></td>
</tr>
<tr>
<td><code>index_type</code></td>
<td>database type for a container's index type</td>
- <td><a href="#9.2.5">9.2.5</a></td>
+ <td><a href="#10.2.5">10.2.5</a></td>
</tr>
<tr>
<td><code>key_type</code></td>
<td>database type for a container's key type</td>
- <td><a href="#9.2.6">9.2.6</a></td>
+ <td><a href="#10.2.6">10.2.6</a></td>
</tr>
<tr>
<td><code>value_type</code></td>
<td>database type for a container's value type</td>
- <td><a href="#9.2.7">9.2.7</a></td>
+ <td><a href="#10.2.7">10.2.7</a></td>
</tr>
<tr>
<td><code>id_column</code></td>
<td>column name for a container's table object id</td>
- <td><a href="#9.2.8">9.2.8</a></td>
+ <td><a href="#10.2.8">10.2.8</a></td>
</tr>
<tr>
<td><code>index_column</code></td>
<td>column name for a container's table index</td>
- <td><a href="#9.2.9">9.2.9</a></td>
+ <td><a href="#10.2.9">10.2.9</a></td>
</tr>
<tr>
<td><code>key_column</code></td>
<td>column name for a container's table key</td>
- <td><a href="#9.2.10">9.2.10</a></td>
+ <td><a href="#10.2.10">10.2.10</a></td>
</tr>
<tr>
<td><code>value_column</code></td>
<td>column name for a container's table value</td>
- <td><a href="#9.2.11">9.2.11</a></td>
+ <td><a href="#10.2.11">10.2.11</a></td>
</tr>
</table>
<p>Many of the value type specifiers have corresponding member type
- specifiers with the same names (<a href="#9.3">Section 9.3,
+ specifiers with the same names (<a href="#10.3">Section 10.3,
"Data Member Pragmas"</a>). The behavior of such specifiers
for members is similar to that for value types. The only difference
is the scope. A particular value type specifier applies to all the
@@ -5655,7 +5943,7 @@ class person
to a single member. In other words, member specifiers take precedence
over parameters specified with value specifiers.</p>
- <h3><a name="9.2.1">9.2.1 <code>type</code></a></h3>
+ <h3><a name="10.2.1">10.2.1 <code>type</code></a></h3>
<p>The <code>type</code> specifier specifies the native database type
that should be used for data members of this type. For example:</p>
@@ -5703,13 +5991,13 @@ private:
<code>mapping</code> example in the <code>odb-examples</code>
package shows how to do this for all the supported database systems.</p>
- <h3><a name="9.2.2">9.2.2 <code>id_type</code></a></h3>
+ <h3><a name="10.2.2">10.2.2 <code>id_type</code></a></h3>
<p>The <code>id_type</code> specifier specifies the native database type
that should be used for data members of this type that are designated as
- object identifiers (<a href="#9.3.1">Section 9.3.1,
+ object identifiers (<a href="#10.3.1">Section 10.3.1,
"<code>id</code>"</a>). In combination with the <code>type</code>
- specifier (<a href="#9.2.1">Section 9.2.1, "<code>type</code>"</a>)
+ specifier (<a href="#10.2.1">Section 10.2.1, "<code>type</code>"</a>)
<code>id_type</code> allows you to map a C++ type differently depending
on whether it is used in an ordinary member or an object id. For
example:</p>
@@ -5746,7 +6034,7 @@ private:
};
</pre>
- <h3><a name="9.2.3">9.2.3 <code>not_null</code></a></h3>
+ <h3><a name="10.2.3">10.2.3 <code>not_null</code></a></h3>
<p>The <code>not_null</code> specifier specifies that an object pointer
or a container of object pointers cannot have or contain the
@@ -5777,7 +6065,7 @@ typedef std::vector&lt;shared_ptr&lt;account> > accounts;
<p>For a more detailed discussion of the <code>NULL</code> object pointer
semantics, refer to <a href="#6">Chapter 6, "Relationships"</a>.</p>
- <h3><a name="9.2.4">9.2.4 <code>unordered</code></a></h3>
+ <h3><a name="10.2.4">10.2.4 <code>unordered</code></a></h3>
<p>The <code>unordered</code> specifier specifies that the ordered
container should be stored unordered in the database. The database
@@ -5794,13 +6082,13 @@ typedef std::vector&lt;std::string> names;
storage in the database, refer to <a href="#5.1">Section 5.1,
"Ordered Containers"</a>.</p>
- <h3><a name="9.2.5">9.2.5 <code>index_type</code></a></h3>
+ <h3><a name="10.2.5">10.2.5 <code>index_type</code></a></h3>
<p>The <code>index_type</code> specifier specifies the native
database type that should be used for an ordered container's
index column. The semantics of <code>index_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.2.1">Section 9.2.1, "<code>type</code>"</a>). The native
+ (<a href="#10.2.1">Section 10.2.1, "<code>type</code>"</a>). The native
database type is expected to be an integer type. For example:</p>
<pre class="c++">
@@ -5808,13 +6096,13 @@ typedef std::vector&lt;std::string> names;
#pragma db value(names) index_type("SMALLINT UNSIGNED NOT NULL")
</pre>
- <h3><a name="9.2.6">9.2.6 <code>key_type</code></a></h3>
+ <h3><a name="10.2.6">10.2.6 <code>key_type</code></a></h3>
<p>The <code>key_type</code> specifier specifies the native
database type that should be used for a map container's
key column. The semantics of <code>key_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.2.1">Section 9.2.1, "<code>type</code>"</a>). For
+ (<a href="#10.2.1">Section 10.2.1, "<code>type</code>"</a>). For
example:</p>
<pre class="c++">
@@ -5822,13 +6110,13 @@ typedef std::map&lt;unsigned short, float> age_weight_map;
#pragma db value(age_weight_map) key_type("INT UNSIGNED NOT NULL")
</pre>
- <h3><a name="9.2.7">9.2.7 <code>value_type</code></a></h3>
+ <h3><a name="10.2.7">10.2.7 <code>value_type</code></a></h3>
<p>The <code>value_type</code> specifier specifies the native
database type that should be used for a container's
value column. The semantics of <code>value_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.2.1">Section 9.2.1, "<code>type</code>"</a>). For
+ (<a href="#10.2.1">Section 10.2.1, "<code>type</code>"</a>). For
example:</p>
<pre class="c++">
@@ -5836,7 +6124,7 @@ typedef std::vector&lt;std::string> names;
#pragma db value(names) value_type("VARCHAR(255) NOT NULL")
</pre>
- <h3><a name="9.2.8">9.2.8 <code>id_column</code></a></h3>
+ <h3><a name="10.2.8">10.2.8 <code>id_column</code></a></h3>
<p>The <code>id_column</code> specifier specifies the column
name that should be used to store the object id in a
@@ -5850,7 +6138,7 @@ typedef std::vector&lt;std::string> names;
<p>If the column name is not specified, then <code>object_id</code>
is used by default.</p>
- <h3><a name="9.2.9">9.2.9 <code>index_column</code></a></h3>
+ <h3><a name="10.2.9">10.2.9 <code>index_column</code></a></h3>
<p>The <code>index_column</code> specifier specifies the column
name that should be used to store the element index in an
@@ -5864,7 +6152,7 @@ typedef std::vector&lt;std::string> names;
<p>If the column name is not specified, then <code>index</code>
is used by default.</p>
- <h3><a name="9.2.10">9.2.10 <code>key_column</code></a></h3>
+ <h3><a name="10.2.10">10.2.10 <code>key_column</code></a></h3>
<p>The <code>key_column</code> specifier specifies the column
name that should be used to store the key in a map
@@ -5878,7 +6166,7 @@ typedef std::map&lt;unsigned short, float> age_weight_map;
<p>If the column name is not specified, then <code>key</code>
is used by default.</p>
- <h3><a name="9.2.11">9.2.11 <code>value_column</code></a></h3>
+ <h3><a name="10.2.11">10.2.11 <code>value_column</code></a></h3>
<p>The <code>value_column</code> specifier specifies the column
name that should be used to store the element value in a
@@ -5895,7 +6183,7 @@ typedef std::map&lt;unsigned short, float> age_weight_map;
<!-- Data Member Pragmas -->
- <h2><a name="9.3">9.3 Data Member Pragmas</a></h2>
+ <h2><a name="10.3">10.3 Data Member Pragmas</a></h2>
<p>A pragma with the <code>member</code> qualifier or a positioned
pragma without a qualifier describes a data member. It can
@@ -5913,104 +6201,104 @@ typedef std::map&lt;unsigned short, float> age_weight_map;
<tr>
<td><code>id</code></td>
<td>member is an object id</td>
- <td><a href="#9.3.1">9.3.1</a></td>
+ <td><a href="#10.3.1">10.3.1</a></td>
</tr>
<tr>
<td><code>auto</code></td>
<td>id is assigned by the database</td>
- <td><a href="#9.3.2">9.3.2</a></td>
+ <td><a href="#10.3.2">10.3.2</a></td>
</tr>
<tr>
<td><code>type</code></td>
<td>database type for member</td>
- <td><a href="#9.3.3">9.3.3</a></td>
+ <td><a href="#10.3.3">10.3.3</a></td>
</tr>
<tr>
<td><code>column</code></td>
<td>column name for member</td>
- <td><a href="#9.3.4">9.3.4</a></td>
+ <td><a href="#10.3.4">10.3.4</a></td>
</tr>
<tr>
<td><code>transient</code></td>
<td>member is not stored in the database</td>
- <td><a href="#9.3.5">9.3.5</a></td>
+ <td><a href="#10.3.5">10.3.5</a></td>
</tr>
<tr>
<td><code>not_null</code></td>
<td>object pointer cannot be NULL</td>
- <td><a href="#9.3.6">9.3.6</a></td>
+ <td><a href="#10.3.6">10.3.6</a></td>
</tr>
<tr>
<td><code>inverse</code></td>
<td>member is an inverse side of a bidirectional relationship</td>
- <td><a href="#9.3.7">9.3.7</a></td>
+ <td><a href="#10.3.7">10.3.7</a></td>
</tr>
<tr>
<td><code>unordered</code></td>
<td>ordered container should be stored unordered</td>
- <td><a href="#9.3.8">9.3.8</a></td>
+ <td><a href="#10.3.8">10.3.8</a></td>
</tr>
<tr>
<td><code>table</code></td>
<td>table name for a container</td>
- <td><a href="#9.3.9">9.3.9</a></td>
+ <td><a href="#10.3.9">10.3.9</a></td>
</tr>
<tr>
<td><code>index_type</code></td>
<td>database type for a container's index type</td>
- <td><a href="#9.3.10">9.3.10</a></td>
+ <td><a href="#10.3.10">10.3.10</a></td>
</tr>
<tr>
<td><code>key_type</code></td>
<td>database type for a container's key type</td>
- <td><a href="#9.3.11">9.3.11</a></td>
+ <td><a href="#10.3.11">10.3.11</a></td>
</tr>
<tr>
<td><code>value_type</code></td>
<td>database type for a container's value type</td>
- <td><a href="#9.3.12">9.3.12</a></td>
+ <td><a href="#10.3.12">10.3.12</a></td>
</tr>
<tr>
<td><code>id_column</code></td>
<td>column name for a container's object id</td>
- <td><a href="#9.3.13">9.3.13</a></td>
+ <td><a href="#10.3.13">10.3.13</a></td>
</tr>
<tr>
<td><code>index_column</code></td>
<td>column name for a container's index</td>
- <td><a href="#9.3.14">9.3.14</a></td>
+ <td><a href="#10.3.14">10.3.14</a></td>
</tr>
<tr>
<td><code>key_column</code></td>
<td>column name for a container's key</td>
- <td><a href="#9.3.15">9.3.15</a></td>
+ <td><a href="#10.3.15">10.3.15</a></td>
</tr>
<tr>
<td><code>value_column</code></td>
<td>column name for a container's value</td>
- <td><a href="#9.3.16">9.3.16</a></td>
+ <td><a href="#10.3.16">10.3.16</a></td>
</tr>
</table>
<p>Many of the member specifiers have corresponding value type
- specifiers with the same names (<a href="#9.2">Section 9.2,
+ specifiers with the same names (<a href="#10.2">Section 10.2,
"Value Type Pragmas"</a>). The behavior of such specifiers
for members is similar to that for value types. The only difference
is the scope. A particular value type specifier applies to all the
@@ -6019,7 +6307,7 @@ typedef std::map&lt;unsigned short, float> age_weight_map;
to a single member. In other words, member specifiers take precedence
over parameters specified with value specifiers.</p>
- <h3><a name="9.3.1">9.3.1 <code>id</code></a></h3>
+ <h3><a name="10.3.1">10.3.1 <code>id</code></a></h3>
<p>The <code>id</code> specifier specifies that a data member contains
the object id. Every persistent class must have a member designated
@@ -6040,7 +6328,7 @@ private:
<p>In a relational database, an identifier member is mapped to a
primary key.</p>
- <h3><a name="9.3.2">9.3.2 <code>auto</code></a></h3>
+ <h3><a name="10.3.2">10.3.2 <code>auto</code></a></h3>
<p>The <code>auto</code> specifier specifies that the object's identifier
is automatically assigned by the database. Only a member that was
@@ -6068,7 +6356,7 @@ private:
<p>For additional information on the automatic identifier assignment,
refer to <a href="#3.6">Section 3.6, "Making Objects Persistent"</a>.</p>
- <h3><a name="9.3.3">9.3.3 <code>type</code></a></h3>
+ <h3><a name="10.3.3">10.3.3 <code>type</code></a></h3>
<p>The <code>type</code> specifier specifies the native database type
that should be used for a data member. For example:</p>
@@ -6085,7 +6373,7 @@ private:
};
</pre>
- <h3><a name="9.3.4">9.3.4 <code>column</code></a></h3>
+ <h3><a name="10.3.4">10.3.4 <code>column</code></a></h3>
<p>The <code>column</code> specifier specifies the column name
that should be used to store a data member in a relational database.
@@ -6111,7 +6399,7 @@ private:
name by removing the common data member name decorations, such as leading
and trailing underscores, the <code>m_</code> prefix, etc.</p>
- <h3><a name="9.3.5">9.3.5 <code>transient</code></a></h3>
+ <h3><a name="10.3.5">10.3.5 <code>transient</code></a></h3>
<p>The <code>transient</code> specifier instructs the ODB compiler
not to store a data member in the database. For example:</p>
@@ -6134,7 +6422,7 @@ private:
references that are only meaningful in the application's
memory, as well as utility members such as mutexes, etc.</p>
- <h3><a name="9.3.6">9.3.6 <code>not_null</code></a></h3>
+ <h3><a name="10.3.6">10.3.6 <code>not_null</code></a></h3>
<p>The <code>not_null</code> specifier specifies that a data member of
an object pointer or a container of object pointers type cannot
@@ -6166,7 +6454,7 @@ private:
<p>For a more detailed discussion of the <code>NULL</code> object pointer
semantics, refer to <a href="#6">Chapter 6, "Relationships"</a>.</p>
- <h3><a name="9.3.7">9.3.7 <code>inverse</code></a></h3>
+ <h3><a name="10.3.7">10.3.7 <code>inverse</code></a></h3>
<p>The <code>inverse</code> specifier specifies that a data member of
an object pointer or a container of object pointers type is an
@@ -6206,12 +6494,12 @@ private:
relationship information. Only ordered and set containers can be used
for inverse members. If an inverse member is of an ordered container
type, it is automatically marked as unordered
- (<a href="#9.3.8">Section 9.3.8, "<code>unordered</code>"</a>).</p>
+ (<a href="#10.3.8">Section 10.3.8, "<code>unordered</code>"</a>).</p>
<p>For a more detailed discussion of inverse members, refer to
<a href="#6.2">Section 6.2, "Bidirectional Relationships"</a>.</p>
- <h3><a name="9.3.8">9.3.8 <code>unordered</code></a></h3>
+ <h3><a name="10.3.8">10.3.8 <code>unordered</code></a></h3>
<p>The <code>unordered</code> specifier specifies that a member of
an ordered container type should be stored unordered in the database.
@@ -6235,7 +6523,7 @@ private:
storage in the database, refer to <a href="#5.1">Section 5.1,
"Ordered Containers"</a>.</p>
- <h3><a name="9.3.9">9.3.9 <code>table</code></a></h3>
+ <h3><a name="10.3.9">10.3.9 <code>table</code></a></h3>
<p>The <code>table</code> specifier specifies the table name that should
be used to store the contents of a container member. For example:</p>
@@ -6266,13 +6554,13 @@ private:
to <a href="#7.1">Section 7.1, "Composite Value Column and Table
Names"</a> for details.</p>
- <h3><a name="9.3.10">9.3.10 <code>index_type</code></a></h3>
+ <h3><a name="10.3.10">10.3.10 <code>index_type</code></a></h3>
<p>The <code>index_type</code> specifier specifies the native
database type that should be used for an ordered container's
index column of a data member. The semantics of <code>index_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>). The native
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>). The native
database type is expected to be an integer type. For example:</p>
<pre class="c++">
@@ -6287,13 +6575,13 @@ private:
};
</pre>
- <h3><a name="9.3.11">9.3.11 <code>key_type</code></a></h3>
+ <h3><a name="10.3.11">10.3.11 <code>key_type</code></a></h3>
<p>The <code>key_type</code> specifier specifies the native
database type that should be used for a map container's
key column of a data member. The semantics of <code>key_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>). For
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>). For
example:</p>
<pre class="c++">
@@ -6308,13 +6596,13 @@ private:
};
</pre>
- <h3><a name="9.3.12">9.3.12 <code>value_type</code></a></h3>
+ <h3><a name="10.3.12">10.3.12 <code>value_type</code></a></h3>
<p>The <code>value_type</code> specifier specifies the native
database type that should be used for a container's
value column of a data member. The semantics of <code>value_type</code>
are similar to that of the <code>type</code> specifier
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>). For
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>). For
example:</p>
<pre class="c++">
@@ -6329,14 +6617,14 @@ private:
};
</pre>
- <h3><a name="9.3.13">9.3.13 <code>id_column</code></a></h3>
+ <h3><a name="10.3.13">10.3.13 <code>id_column</code></a></h3>
<p>The <code>id_column</code> specifier specifies the column
name that should be used to store the object id in a
container's table for a data member. The semantics of
<code>id_column</code> are similar to that of the
<code>column</code> specifier
- (<a href="#9.3.4">Section 9.3.4, "<code>column</code>"</a>).
+ (<a href="#10.3.4">Section 10.3.4, "<code>column</code>"</a>).
For example:</p>
<pre class="c++">
@@ -6354,14 +6642,14 @@ private:
<p>If the column name is not specified, then <code>object_id</code>
is used by default.</p>
- <h3><a name="9.3.14">9.3.14 <code>index_column</code></a></h3>
+ <h3><a name="10.3.14">10.3.14 <code>index_column</code></a></h3>
<p>The <code>index_column</code> specifier specifies the column
name that should be used to store the element index in an
ordered container's table for a data member. The semantics of
<code>index_column</code> are similar to that of the
<code>column</code> specifier
- (<a href="#9.3.4">Section 9.3.4, "<code>column</code>"</a>).
+ (<a href="#10.3.4">Section 10.3.4, "<code>column</code>"</a>).
For example:</p>
<pre class="c++">
@@ -6379,14 +6667,14 @@ private:
<p>If the column name is not specified, then <code>index</code>
is used by default.</p>
- <h3><a name="9.3.15">9.3.15 <code>key_column</code></a></h3>
+ <h3><a name="10.3.15">10.3.15 <code>key_column</code></a></h3>
<p>The <code>key_column</code> specifier specifies the column
name that should be used to store the key in a map
container's table for a data member. The semantics of
<code>key_column</code> are similar to that of the
<code>column</code> specifier
- (<a href="#9.3.4">Section 9.3.4, "<code>column</code>"</a>).
+ (<a href="#10.3.4">Section 10.3.4, "<code>column</code>"</a>).
For example:</p>
<pre class="c++">
@@ -6404,14 +6692,14 @@ private:
<p>If the column name is not specified, then <code>key</code>
is used by default.</p>
- <h3><a name="9.3.16">9.3.16 <code>value_column</code></a></h3>
+ <h3><a name="10.3.16">10.3.16 <code>value_column</code></a></h3>
<p>The <code>value_column</code> specifier specifies the column
name that should be used to store the element value in a
container's table for a data member. The semantics of
<code>value_column</code> are similar to that of the
<code>column</code> specifier
- (<a href="#9.3.4">Section 9.3.4, "<code>column</code>"</a>).
+ (<a href="#10.3.4">Section 10.3.4, "<code>column</code>"</a>).
For example:</p>
<pre class="c++">
@@ -6429,7 +6717,7 @@ private:
<p>If the column name is not specified, then <code>value</code>
is used by default.</p>
- <h2><a name="9.4">9.4 C++ Compiler Warnings</a></h2>
+ <h2><a name="10.4">10.4 C++ Compiler Warnings</a></h2>
<p>When a C++ header file defining persistent classes and containing
ODB pragmas is used to build the application, the C++ compiler may
@@ -6484,7 +6772,7 @@ private:
<p>The disadvantage of this approach is that it can quickly become
overly verbose when positioned pragmas are used.</p>
- <h3><a name="9.4.1">9.4.1 GNU C++</a></h3>
+ <h3><a name="10.4.1">10.4.1 GNU C++</a></h3>
<p>GNU g++ does not issue warnings about unknown pragmas
unless requested with the <code>-Wall</code> command line option.
@@ -6496,7 +6784,7 @@ private:
g++ -Wall -Wno-unknown-pragmas ...
</pre>
- <h3><a name="9.4.2">9.4.2 Visual C++</a></h3>
+ <h3><a name="10.4.2">10.4.2 Visual C++</a></h3>
<p>Microsoft Visual C++ issues an unknown pragma warning (C4068) at
warning level 1 or higher. This means that unless we have disabled
@@ -6531,7 +6819,7 @@ private:
#pragma warning (pop)
</pre>
- <h3><a name="9.4.3">9.4.3 Sun C++</a></h3>
+ <h3><a name="10.4.3">10.4.3 Sun C++</a></h3>
<p>The Sun C++ compiler does not issue warnings about unknown pragmas
unless the <code>+w</code> or <code>+w2</code> option is specified.
@@ -6543,7 +6831,7 @@ private:
CC +w -erroff=unknownpragma ...
</pre>
- <h3><a name="9.4.4">9.4.4 IBM XL C++</a></h3>
+ <h3><a name="10.4.4">10.4.4 IBM XL C++</a></h3>
<p>IBM XL C++ issues an unknown pragma warning (1540-1401) by default.
To disable this warning we can add the <code>-qsuppress=1540-1401</code>
@@ -6553,7 +6841,7 @@ CC +w -erroff=unknownpragma ...
xlC -qsuppress=1540-1401 ...
</pre>
- <h3><a name="9.4.5">9.4.5 HP aC++</a></h3>
+ <h3><a name="10.4.5">10.4.5 HP aC++</a></h3>
<p>HP aC++ (aCC) issues an unknown pragma warning (2161) by default.
To disable this warning we can add the <code>+W2161</code>
@@ -6579,8 +6867,8 @@ aCC +W2161 ...
chapters.</p>
<table class="toc">
- <tr><th>10</th><td><a href="#10">MySQL Database</a></td></tr>
- <tr><th>11</th><td><a href="#11">SQLite Database</a></td></tr>
+ <tr><th>11</th><td><a href="#11">MySQL Database</a></td></tr>
+ <tr><th>12</th><td><a href="#12">SQLite Database</a></td></tr>
</table>
@@ -6588,7 +6876,7 @@ aCC +W2161 ...
<hr class="page-break"/>
- <h1><a name="10">10 MySQL Database</a></h1>
+ <h1><a name="11">11 MySQL Database</a></h1>
<p>To generate support code for the MySQL database you will need
to pass the "<code>--database&nbsp;mysql</code>"
@@ -6597,12 +6885,12 @@ aCC +W2161 ...
library (<code>libodb-mysql</code>). All MySQL-specific ODB
classes are defined in the <code>odb::mysql</code> namespace.</p>
- <h2><a name="10.1">10.1 MySQL Type Mapping</a></h2>
+ <h2><a name="11.1">11.1 MySQL Type Mapping</a></h2>
<p>The following table summarizes the default mapping between basic
C++ value types and MySQL database types. This mapping can be
customized on the per-type and per-member basis using the ODB
- Pragmas Language (<a href="#9">Chapter 9, "ODB Pragma
+ Pragmas Language (<a href="#10">Chapter 10, "ODB Pragma
Language"</a>).</p>
<!-- border="1" is necessary for html2ps -->
@@ -6721,7 +7009,7 @@ class object
};
</pre>
- <h2><a name="10.2">10.2 MySQL Database Class</a></h2>
+ <h2><a name="11.2">11.2 MySQL Database Class</a></h2>
<p>The MySQL <code>database</code> class has the following
interface:</p>
@@ -6860,7 +7148,7 @@ namespace odb
<p>This constructor throws the <code>odb::mysql::cli_exception</code>
exception if the MySQL option values are missing or invalid.
- See section <a href="#10.4">Section 10.4, "MySQL Exceptions"</a>
+ See section <a href="#11.4">Section 11.4, "MySQL Exceptions"</a>
for more information on this exception.</p>
<p>The static <code>print_usage()</code> function prints the list of options
@@ -6884,7 +7172,7 @@ namespace odb
handle, refer to the MySQL ODB runtime source code for the interface
of the <code>connection</code> class.</p>
- <h2><a name="10.3">10.3 MySQL Connection Factory</a></h2>
+ <h2><a name="11.3">11.3 MySQL Connection Factory</a></h2>
<p>The <code>connection_factory</code> abstract class has the
following interface:</p>
@@ -7026,7 +7314,7 @@ main (int argc, char* argv[])
}
</pre>
- <h2><a name="10.4">10.4 MySQL Exceptions</a></h2>
+ <h2><a name="11.4">11.4 MySQL Exceptions</a></h2>
<p>The MySQL ODB runtime library defines the following MySQL-specific
exceptions:</p>
@@ -7083,7 +7371,7 @@ namespace odb
<hr class="page-break"/>
- <h1><a name="11">11 SQLite Database</a></h1>
+ <h1><a name="12">12 SQLite Database</a></h1>
<p>To generate support code for the SQLite database you will need
to pass the "<code>--database&nbsp;sqlite</code>"
@@ -7092,12 +7380,12 @@ namespace odb
library (<code>libodb-sqlite</code>). All SQLite-specific ODB
classes are defined in the <code>odb::sqlite</code> namespace.</p>
- <h2><a name="11.1">11.1 SQLite Type Mapping</a></h2>
+ <h2><a name="12.1">12.1 SQLite Type Mapping</a></h2>
<p>The following table summarizes the default mapping between basic
C++ value types and SQLite database types. This mapping can be
customized on the per-type and per-member basis using the ODB
- Pragmas Language (<a href="#9">Chapter 9, "ODB Pragma
+ Pragmas Language (<a href="#10">Chapter 10, "ODB Pragma
Language"</a>).</p>
<!-- border="1" is necessary for html2ps -->
@@ -7191,7 +7479,7 @@ namespace odb
a result, greater <code>unsigned&nbsp;long&nbsp;long</code> values will be
represented in the database as negative values.</p>
- <h2><a name="11.2">11.2 SQLite Database Class</a></h2>
+ <h2><a name="12.2">12.2 SQLite Database Class</a></h2>
<p>The SQLite <code>database</code> class has the following
interface:</p>
@@ -7296,7 +7584,7 @@ auto_ptr&lt;odb::database> db (
<p>The second constructor throws the <code>odb::sqlite::cli_exception</code>
exception if the SQLite option values are missing or invalid.
- See section <a href="#11.4">Section 11.4, "SQLite Exceptions"</a>
+ See section <a href="#12.4">Section 12.4, "SQLite Exceptions"</a>
for more information on this exception.</p>
<p>The static <code>print_usage()</code> function prints the list of options
@@ -7329,7 +7617,7 @@ auto_ptr&lt;odb::database> db (
handle, refer to the SQLite ODB runtime source code for the interface
of the <code>connection</code> class.</p>
- <h2><a name="11.3">11.3 SQLite Connection Factory</a></h2>
+ <h2><a name="12.3">12.3 SQLite Connection Factory</a></h2>
<p>The <code>connection_factory</code> abstract class has the
following interface:</p>
@@ -7489,7 +7777,7 @@ main (int argc, char* argv[])
}
</pre>
- <h2><a name="11.4">11.4 SQLite Exceptions</a></h2>
+ <h2><a name="12.4">12.4 SQLite Exceptions</a></h2>
<p>The SQLite ODB runtime library defines the following SQLite-specific
exceptions:</p>
@@ -7542,12 +7830,12 @@ namespace odb
of an error.</p>
- <h2><a name="11.5">11.5 SQLite Limitations</a></h2>
+ <h2><a name="12.5">12.5 SQLite Limitations</a></h2>
<p>The following sections describe SQLite-specific limitations imposed by
the current SQLite and ODB runtime versions.</p>
- <h3><a name="11.5.1">11.5.1 Query Result Caching</a></h3>
+ <h3><a name="12.5.1">12.5.1 Query Result Caching</a></h3>
<p>SQLite ODB runtime implementation does not perform query result caching
(<a href="#4.4">Section 4.4, "Query Result"</a>) even when explicitly
@@ -7562,17 +7850,17 @@ namespace odb
thrown. Future versions of the SQLite ODB runtime library may add support
for result caching.</p>
- <h3><a name="11.5.2">11.5.2 Automatic Assignment of Object Ids</a></h3>
+ <h3><a name="12.5.2">12.5.2 Automatic Assignment of Object Ids</a></h3>
<p>Due to SQLite API limitations, every automatically assigned object id
- (<a href="#9.3.2">Section 9.3.2, "<code>auto</code>"</a>) should have
+ (<a href="#10.3.2">Section 10.3.2, "<code>auto</code>"</a>) should have
the <code>INTEGER</code> SQLite type. While SQLite will treat other
integer type names (such as <code>INT</code>, <code>BIGINT</code>, etc.)
as <code>INTEGER</code>, automatic id assignment will not work. By default,
ODB maps all C++ integral types to <code>INTEGER</code>. This means that
the only situation that requires consideration is the assignment of a
custom database type using the <code>db&nbsp;type</code> pragma
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>). For
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>). For
example:</p>
<pre class="c++">
@@ -7588,7 +7876,7 @@ class person
};
</pre>
- <h3><a name="11.5.3">11.5.3 Constraint Violations</a></h3>
+ <h3><a name="12.5.3">12.5.3 Constraint Violations</a></h3>
<p>Due to the granularity of the SQLite error codes, it is impossible
to distinguish between the duplicate primary key and other constraint
@@ -7597,7 +7885,7 @@ class person
<code>object_not_persistent</code> exception (<a href="#3.11">Section
3.11, "ODB Exceptions"</a>).</p>
- <h3><a name="11.5.4">11.5.4 Sharing of Queries</a></h3>
+ <h3><a name="12.5.4">12.5.4 Sharing of Queries</a></h3>
<p>As discussed in <a href="#4.3">Section 4.3, "Executing a Query"</a>, a
query instance that does not have any by-reference parameters is
@@ -7618,9 +7906,9 @@ class person
and libraries. It consists of the following chapters.</p>
<table class="toc">
- <tr><th>12</th><td><a href="#12">Profiles Introduction</a></td></tr>
- <tr><th>13</th><td><a href="#13">Boost Profile</a></td></tr>
- <tr><th>14</th><td><a href="#14">Qt Profile</a></td></tr>
+ <tr><th>13</th><td><a href="#13">Profiles Introduction</a></td></tr>
+ <tr><th>14</th><td><a href="#14">Boost Profile</a></td></tr>
+ <tr><th>15</th><td><a href="#15">Qt Profile</a></td></tr>
</table>
@@ -7628,7 +7916,7 @@ class person
<hr class="page-break"/>
- <h1><a name="12">12 Profiles Introduction</a></h1>
+ <h1><a name="13">13 Profiles Introduction</a></h1>
<p>ODB profiles are a generic mechanism for integrating ODB with
widely-used C++ frameworks and libraries. A profile provides glue
@@ -7682,7 +7970,7 @@ odb --profile boost/date-time ...
<hr class="page-break"/>
- <h1><a name="13">13 Boost Profile</a></h1>
+ <h1><a name="14">14 Boost Profile</a></h1>
<p>The ODB profile implementation for Boost is provided by the
<code>libodb-boost</code> library and consists of multiple sub-profiles
@@ -7707,7 +7995,7 @@ odb --profile boost/date-time ...
that can be thrown by the Boost sub-profiles are described in the
following sections.</p>
- <h2><a name="13.1">13.1 Smart Pointers Library</a></h2>
+ <h2><a name="14.1">14.1 Smart Pointers Library</a></h2>
<p>The <code>smart-ptr</code> sub-profile provides persistence
support for a subset of smart pointers from the Boost
@@ -7760,7 +8048,7 @@ class employee
behavior, add the <code>--default-pointer</code> option specifying the
alternative object pointer after the <code>--profile</code> option.</p>
- <h2><a name="13.2">13.2 Unordered Containers Library</a></h2>
+ <h2><a name="14.2">14.2 Unordered Containers Library</a></h2>
<p>The <code>unordered</code> sub-profile provides persistence support for
the containers from the Boost <code>unordered</code> library. To enable
@@ -7786,7 +8074,7 @@ class person
};
</pre>
- <h2><a name="13.3">13.3 Date Time Library</a></h2>
+ <h2><a name="14.3">14.3 Date Time Library</a></h2>
<p>The <code>date-time</code> sub-profile provides persistence support for a
subset of types from the Boost <code>date_time</code> library. It is
@@ -7859,7 +8147,7 @@ namespace odb
exceptions are thrown are database system dependent and are discussed in
more detail in the following sub-sections.</p>
- <h3><a name="13.3.1">13.3.1 MySQL Database Type Mapping</a></h3>
+ <h3><a name="14.3.1">14.3.1 MySQL Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported Boost <code>date_time</code> types and the MySQL database
@@ -7895,7 +8183,7 @@ namespace odb
support for mapping <code>posix_time::ptime</code> to the
<code>TIMESTAMP</code> MySQL type. However, this mapping has to be
explicitly requested using the <code>db&nbsp;type</code> pragma
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>), as shown in
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>), as shown in
the following example:</p>
<pre class="c++">
@@ -7916,7 +8204,7 @@ class person
the <code>out_of_range</code> exception. Refer to the MySQL
documentation for more information on the MySQL data type ranges.</p>
- <h3><a name="13.3.2">13.3.2 SQLite Database Type Mapping</a></h3>
+ <h3><a name="14.3.2">14.3.2 SQLite Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported Boost <code>date_time</code> types and the SQLite database
@@ -7955,7 +8243,7 @@ class person
alternative mapping for <code>posix_time::time_duration</code> to the
<code>INTEGER</code> type represents the duration as a number of
seconds. These mappings have to be explicitly requested using the
- <code>db&nbsp;type</code> pragma (<a href="#9.3.3">Section 9.3.3,
+ <code>db&nbsp;type</code> pragma (<a href="#10.3.3">Section 10.3.3,
"<code>type</code>"</a>), as shown in the following example:</p>
<pre class="c++">
@@ -7994,7 +8282,7 @@ class person
<hr class="page-break"/>
- <h1><a name="14">14 Qt Profile</a></h1>
+ <h1><a name="15">15 Qt Profile</a></h1>
<p>The ODB profile implementation for Qt is provided by the
<code>libodb-qt</code> library and consists of multiple sub-profiles
@@ -8020,7 +8308,7 @@ class person
that can be thrown by the Qt sub-profiles are described in the
following sections.</p>
- <h2><a name="14.1">14.1 Basic Types</a></h2>
+ <h2><a name="15.1">15.1 Basic Types</a></h2>
<p>The <code>basic</code> sub-profile provides persistence support for basic
types defined by Qt. To enable only this profile, pass
@@ -8042,7 +8330,7 @@ class Person
};
</pre>
- <h3><a name="14.1.1">14.1.1 MySQL Database Type Mapping</a></h3>
+ <h3><a name="15.1.1">15.1.1 MySQL Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported basic Qt types and the MySQL database types.</p>
@@ -8077,7 +8365,7 @@ class Person
it is mapped to <code>TEXT</code>.</p>
- <h3><a name="14.1.2">14.1.2 SQLite Database Type Mapping</a></h3>
+ <h3><a name="15.1.2">15.1.2 SQLite Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported basic Qt types and the SQLite database types.</p>
@@ -8104,7 +8392,7 @@ class Person
are stored as a NULL value if their <code>isNull()</code> member
function returns <code>true</code>.</p>
- <h2><a name="14.2">14.2 Smart Pointers</a></h2>
+ <h2><a name="15.2">15.2 Smart Pointers</a></h2>
<p>The <code>smart-ptr</code> sub-profile provides persistence support the
Qt smart pointers. To enable only this profile, pass
@@ -8156,7 +8444,7 @@ class Employee
behavior, add the <code>--default-pointer</code> option specifying the
alternative object pointer after the <code>--profile</code> option.</p>
- <h2><a name="14.3">14.3 Containers Library</a></h2>
+ <h2><a name="15.3">15.3 Containers Library</a></h2>
<p>The <code>container</code> sub-profile provides persistence support for
Qt containers. To enable only this profile, pass
@@ -8181,7 +8469,7 @@ class Person
};
</pre>
- <h2><a name="14.4">14.4 Date Time Types</a></h2>
+ <h2><a name="15.4">15.4 Date Time Types</a></h2>
<p>The <code>date-time</code> sub-profile provides persistence support for
the Qt date-time types. To enable only this profile, pass
@@ -8234,7 +8522,7 @@ namespace odb
system dependent and is discussed in more detail in the
following sub-sections.</p>
- <h3><a name="14.4.1">14.4.1 MySQL Database Type Mapping</a></h3>
+ <h3><a name="15.4.1">15.4.1 MySQL Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported Qt date-time types and the MySQL database types.</p>
@@ -8270,7 +8558,7 @@ namespace odb
support for mapping <code>QDateTime</code> to the <code>TIMESTAMP</code>
MySQL type. However, this mapping has to be explicitly requested using
the <code>db&nbsp;type</code> pragma
- (<a href="#9.3.3">Section 9.3.3, "<code>type</code>"</a>), as shown in
+ (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>), as shown in
the following example:</p>
<pre class="c++">
@@ -8289,7 +8577,7 @@ class Person
the MySQL documentation for more information on the MySQL data type
ranges.</p>
- <h3><a name="14.4.2">14.4.2 SQLite Database Type Mapping</a></h3>
+ <h3><a name="15.4.2">15.4.2 SQLite Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently
supported Qt date-time types and the SQLite database types.</p>
@@ -8328,7 +8616,7 @@ class Person
the <code>INTEGER</code> type represents a clock time as the number of
seconds since midnight. These mappings have to be explicitly requested
using the <code>db&nbsp;type</code> pragma
- (<a href="#9.3.3">Section 9.3.3,value "<code>type</code>"</a>), as shown
+ (<a href="#10.3.3">Section 10.3.3,value "<code>type</code>"</a>), as shown
in the following example:</p>
<pre class="c++">