From 2709ab07167efffddd65f772ff99361bba30b006 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 28 Jul 2011 10:12:34 +0200 Subject: Documentation for std::vector to BLOB mapping --- doc/manual.xhtml | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) (limited to 'doc') diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 47ec14b..ede430d 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -7725,6 +7725,41 @@ aCC +W2161 ... to the VARCHAR(255) MySQL type. Otherwise, it is mapped to TEXT.

+

The MySQL ODB runtime library also provides support for mapping the + std::vector<char> type to the MySQL BLOB types. + However, this mapping is not enabled by default (by default, + std::vector<char> 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 10.3.3, "type"), + for example:

+ +
+#pragma db object
+class object
+{
+  ...
+
+  #pragma db type("BLOB")
+  std::vector<char> buf_;
+};
+  
+ +

Alternatively, this can be done on the per-type basis, for example:

+ +
+typedef std::vector<char> buffer;
+#pragma db value(buffer) type("BLOB")
+
+#pragma db object
+class object
+{
+  ...
+
+  buffer buf_; // Mapped to BLOB.
+};
+  
+

Additionally, by default, C++ enumerations are automatically mapped to a suitable MySQL type. Contiguous enumerations with the zero first enumerator are mapped to the MySQL ENUM @@ -8230,6 +8265,41 @@ namespace odb +

The SQLite ODB runtime library also provides support for mapping the + std::vector<char> type to the SQLite BLOB type. + However, this mapping is not enabled by default (by default, + std::vector<char> 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 10.3.3, "type"), + for example:

+ +
+#pragma db object
+class object
+{
+  ...
+
+  #pragma db type("BLOB")
+  std::vector<char> buf_;
+};
+  
+ +

Alternatively, this can be done on the per-type basis, for example:

+ +
+typedef std::vector<char> buffer;
+#pragma db value(buffer) type("BLOB")
+
+#pragma db object
+class object
+{
+  ...
+
+  buffer buf_; // Mapped to BLOB.
+};
+  
+

Additionally, by default, C++ enumerations are automatically mapped to the SQLite INTEGER type with the default NULL semantics being NOT NULL.

@@ -8780,6 +8850,41 @@ class person +

The PostgreSQL ODB runtime library also provides support for mapping the + std::vector<char> type to the PostgreSQL BYTEA type. + However, this mapping is not enabled by default (by default, + std::vector<char> 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 10.3.3, "type"), + for example:

+ +
+#pragma db object
+class object
+{
+  ...
+
+  #pragma db type("BYTEA")
+  std::vector<char> buf_;
+};
+  
+ +

Alternatively, this can be done on the per-type basis, for example:

+ +
+typedef std::vector<char> buffer;
+#pragma db value(buffer) type("BYTEA")
+
+#pragma db object
+class object
+{
+  ...
+
+  buffer buf_; // Mapped to BYTEA.
+};
+  
+

Additionally, by default, C++ enumerations are automatically mapped to INTEGER with the default NULL semantics being NOT NULL.

-- cgit v1.1