aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-30 15:53:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-30 15:54:08 +0200
commit7658d9946cca973cf5f4e875b5386afa6e0821b9 (patch)
treee582ac6c7aa3dc1f86b7a02ad7f6ea03667e21cb
parent615be3f955f6f0c9d2c00d55d8a53512310abd0a (diff)
Document alternative string mappings for MySQL and PostgreSQL
-rw-r--r--doc/manual.xhtml64
1 files changed, 56 insertions, 8 deletions
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index eb74640..580cb91 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -10477,12 +10477,14 @@ aCC +W2161 ...
it is mapped to <code>TEXT</code>.</p>
<p>The MySQL ODB runtime library also provides support for mapping the
- <code>std::vector&lt;char></code>,
+ <code>std::string</code> type to the MySQL <code>CHAR</code>,
+ <code>NCHAR</code>, and <code>NVARCHAR</code> types, as well as for
+ mapping the <code>std::vector&lt;char></code>,
<code>std::vector&lt;unsigned&nbsp;char></code>,
<code>char[N]</code>, and <code>unsigned&nbsp;char[N]</code> types
- to the MySQL BLOB types. However, this mapping is not enabled by
+ to the MySQL BLOB types. However, these mappings are not enabled by
default (in particular, by default, <code>std::vector</code> will
- be treated as a container). To enable the BLOB mapping for these
+ be treated as a container). To enable the alternative mapping for these
types we need to specify the database type explicitly using the
<code>db&nbsp;type</code> pragma (<a href="#12.4.3">Section
12.4.3, "<code>type</code>"</a>), for example:</p>
@@ -10493,6 +10495,9 @@ class object
{
...
+ #pragma db type("CHAR(2)")
+ std::string state_;
+
#pragma db type("BLOB")
std::vector&lt;char> buf_;
@@ -11849,14 +11854,16 @@ CREATE TABLE Employee (
</tr>
</table>
- <p>The PostgreSQL ODB runtime library also provides support for mapping the
+ <p>The PostgreSQL ODB runtime library also provides support for mapping
+ the <code>std::string</code> type to the PostgreSQL <code>CHAR</code>
+ and <code>VARCHAR</code> types, as well as for mapping the
<code>std::vector&lt;char></code>,
<code>std::vector&lt;unsigned&nbsp;char></code>,
<code>char[N]</code>, and <code>unsigned&nbsp;char[N]</code> types to
- the PostgreSQL <code>BYTEA</code> type. However, this mapping is not
+ the PostgreSQL <code>BYTEA</code> type. However, these mappings are not
enabled by default (in particular, by default, <code>std::vector</code>
- will be treated as a container). To enable the <code>BYTEA</code>
- mapping for these types we need to specify the database type explicitly
+ will be treated as a container). To enable the alternative mappings for
+ these types we need to specify the database type explicitly
using the <code>db&nbsp;type</code> pragma (<a href="#12.4.3">Section
12.4.3, "<code>type</code>"</a>), for example:</p>
@@ -11866,6 +11873,9 @@ class object
{
...
+ #pragma db type("CHAR(2)")
+ std::string state_;
+
#pragma db type("BYTEA")
std::vector&lt;char> buf_;
@@ -12487,7 +12497,7 @@ SHOW integer_datetimes
the Oracle <code>BLOB</code> and <code>RAW</code> types. However, these
mappings are not enabled by default (in particular, by default,
<code>std::vector</code> will be treated as a container). To enable the
- these alternative mappings for these types we need to specify the
+ alternative mappings for these types we need to specify the
database type explicitly using the <code>db&nbsp;type</code> pragma
(<a href="#12.4.3">Section 12.4.3, "<code>type</code>"</a>), for
example:</p>
@@ -13740,6 +13750,25 @@ class Person
to the <code>VARCHAR(255)</code> MySQL type. Otherwise,
it is mapped to <code>TEXT</code>.</p>
+ <p>The <code>basic</code> sub-profile also provides support
+ for mapping <code>QString</code> to the <code>CHAR</code>,
+ <code>NCHAR</code>, and <code>NVARCHAR</code> MySQL types.
+ However, these altenative mappings have to be explicitly
+ requested using the <code>db&nbsp;type</code> pragma
+ (<a href="#12.4.3">Section 12.4.3, "type"</a>), as show in
+ the following example:</p>
+
+ <pre class="c++">
+#pragma db object
+class Person
+{
+ ...
+
+ #pragma db type("CHAR(2)") not_null
+ QString licenseState_;
+};
+ </pre>
+
<h3><a name="19.1.2">19.1.2 SQLite Database Type Mapping</a></h3>
@@ -13801,6 +13830,25 @@ class Person
are stored as a NULL value if their <code>isNull()</code> member
function returns <code>true</code>.</p>
+ <p>The <code>basic</code> sub-profile also provides support
+ for mapping <code>QString</code> to the <code>CHAR</code>,
+ and <code>VARCHAR</code> PostgreSQL types.
+ However, these altenative mappings have to be explicitly
+ requested using the <code>db&nbsp;type</code> pragma
+ (<a href="#12.4.3">Section 12.4.3, "type"</a>), as show in
+ the following example:</p>
+
+ <pre class="c++">
+#pragma db object
+class Person
+{
+ ...
+
+ #pragma db type("CHAR(2)") not_null
+ QString licenseState_;
+};
+ </pre>
+
<h3><a name="19.1.4">19.1.4 Oracle Database Type Mapping</a></h3>
<p>The following table summarizes the default mapping between the currently