From 42b1b0509d0077fd427168fe71296eadf04dfb04 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 3 Nov 2011 10:20:57 +0200 Subject: Add support for mapping char[N] and unsigned char[N] types to BLOB New test: common/blob. --- doc/manual.xhtml | 60 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 3925dea..e04444d 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -9788,14 +9788,15 @@ aCC +W2161 ... it is mapped to TEXT.

The MySQL ODB runtime library also provides support for mapping the - std::vector<char> and - std::vector<unsigned char> types to the MySQL - BLOB types. However, this mapping is not enabled by default (by - default, std::vector will be treated as a container). - To enable the BLOB mapping for this type we need to specify - the database type explicitly using the db type - pragma (Section 11.4.3, "type"), - for example:

+ 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 + default (in particular, by default, std::vector will + be treated as a container). To enable the BLOB mapping for these + types we need to specify the database type explicitly using the + db type pragma (Section + 11.4.3, "type"), for example:

 #pragma db object
@@ -9805,6 +9806,9 @@ class object
 
   #pragma db type("BLOB")
   std::vector<char> buf_;
+
+  #pragma db type("BLOB")
+  unsigned char[16] uuid_;
 };
   
@@ -10414,14 +10418,15 @@ namespace odb

The SQLite ODB runtime library also provides support for mapping the - std::vector<char> and - std::vector<unsigned char> types to the SQLite - BLOB type. However, this mapping is not enabled by default (by default, - std::vector will be treated as a container). - To enable the BLOB mapping for this type we need to specify - the database type explicitly using the db type - pragma (Section 11.4.3, "type"), - for example:

+ std::vector<char>, + std::vector<unsigned char>, + char[N], and unsigned char[N] types to + the SQLite BLOB type. However, this mapping is not enabled by default + (in particular, by default, std::vector will be treated + as a container). To enable the BLOB mapping for these types we need + to specify the database type explicitly using the + db type pragma (Section 11.4.3, + "type"), for example:

 #pragma db object
@@ -10431,6 +10436,9 @@ class object
 
   #pragma db type("BLOB")
   std::vector<char> buf_;
+
+  #pragma db type("BLOB")
+  unsigned char[16] uuid_;
 };
   
@@ -11152,14 +11160,15 @@ CREATE TABLE Employee (

The PostgreSQL ODB runtime library also provides support for mapping the - std::vector<char> and - std::vector<unsigned char> types to the PostgreSQL - BYTEA type. However, this mapping is not enabled by default - (by default, std::vector will be treated as a container). - To enable the BYTEA mapping for this type we need to specify - the database type explicitly using the db type - pragma (Section 11.4.3, "type"), - for example:

+ std::vector<char>, + std::vector<unsigned char>, + char[N], and unsigned char[N] types to + the PostgreSQL BYTEA type. However, this mapping is 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 + using the db type pragma (Section + 11.4.3, "type"), for example:

 #pragma db object
@@ -11169,6 +11178,9 @@ class object
 
   #pragma db type("BYTEA")
   std::vector<char> buf_;
+
+  #pragma db type("BYTEA")
+  unsigned char[16] uuid_;
 };
   
-- cgit v1.1