From 7658d9946cca973cf5f4e875b5386afa6e0821b9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 30 Nov 2011 15:53:06 +0200 Subject: Document alternative string mappings for MySQL and PostgreSQL --- doc/manual.xhtml | 64 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file 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 TEXT.

The MySQL ODB runtime library also provides support for mapping the - std::vector<char>, + std::string type to the MySQL CHAR, + NCHAR, and NVARCHAR types, as well as for + mapping the std::vector<char>, std::vector<unsigned char>, char[N], and unsigned char[N] 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, std::vector 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 db type pragma (Section 12.4.3, "type"), for example:

@@ -10493,6 +10495,9 @@ class object { ... + #pragma db type("CHAR(2)") + std::string state_; + #pragma db type("BLOB") std::vector<char> buf_; @@ -11849,14 +11854,16 @@ CREATE TABLE Employee ( -

The PostgreSQL ODB runtime library also provides support for mapping the +

The PostgreSQL ODB runtime library also provides support for mapping + the std::string type to the PostgreSQL CHAR + and VARCHAR types, as well as for mapping the std::vector<char>, std::vector<unsigned char>, char[N], and unsigned char[N] types to - the PostgreSQL BYTEA type. However, this mapping is not + the PostgreSQL BYTEA type. However, these mappings are not enabled by default (in particular, by default, std::vector - will be treated as a container). To enable the BYTEA - 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 db type pragma (Section 12.4.3, "type"), for example:

@@ -11866,6 +11873,9 @@ class object { ... + #pragma db type("CHAR(2)") + std::string state_; + #pragma db type("BYTEA") std::vector<char> buf_; @@ -12487,7 +12497,7 @@ SHOW integer_datetimes the Oracle BLOB and RAW types. However, these mappings are not enabled by default (in particular, by default, std::vector 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 db type pragma (Section 12.4.3, "type"), for example:

@@ -13740,6 +13750,25 @@ class Person to the VARCHAR(255) MySQL type. Otherwise, it is mapped to TEXT.

+

The basic sub-profile also provides support + for mapping QString to the CHAR, + NCHAR, and NVARCHAR MySQL types. + However, these altenative mappings have to be explicitly + requested using the db type pragma + (Section 12.4.3, "type"), as show in + the following example:

+ +
+#pragma db object
+class Person
+{
+  ...
+
+  #pragma db type("CHAR(2)") not_null
+  QString licenseState_;
+};
+  
+

19.1.2 SQLite Database Type Mapping

@@ -13801,6 +13830,25 @@ class Person are stored as a NULL value if their isNull() member function returns true.

+

The basic sub-profile also provides support + for mapping QString to the CHAR, + and VARCHAR PostgreSQL types. + However, these altenative mappings have to be explicitly + requested using the db type pragma + (Section 12.4.3, "type"), as show in + the following example:

+ +
+#pragma db object
+class Person
+{
+  ...
+
+  #pragma db type("CHAR(2)") not_null
+  QString licenseState_;
+};
+  
+

19.1.4 Oracle Database Type Mapping

The following table summarizes the default mapping between the currently -- cgit v1.1