diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | doc/manual.xhtml | 105 |
2 files changed, 111 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Version 1.6.0 + + * Support for mapping std::vector<char> to the BLOB (or equivalent) + types. For more information, refer to chapters 11 (for MySQL), 12 + (for SQLite) and 13 (for PostgreSQL) in the ODB manual. + Version 1.5.0 * Support for the PostgreSQL database. The provided connection factories 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 <code>VARCHAR(255)</code> MySQL type. Otherwise, it is mapped to <code>TEXT</code>.</p> + <p>The MySQL ODB runtime library also provides support for mapping the + <code>std::vector<char></code> type to the MySQL BLOB types. + However, this mapping is not enabled by default (by default, + <code>std::vector<char></code> will be treated as a container). + To enable the BLOB mapping for this type we need to specify + the database type explicitly using the <code>db type</code> + pragma (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>), + for example:</p> + + <pre class="c++"> +#pragma db object +class object +{ + ... + + #pragma db type("BLOB") + std::vector<char> buf_; +}; + </pre> + + <p>Alternatively, this can be done on the per-type basis, for example:</p> + + <pre class="c++"> +typedef std::vector<char> buffer; +#pragma db value(buffer) type("BLOB") + +#pragma db object +class object +{ + ... + + buffer buf_; // Mapped to BLOB. +}; + </pre> + <p>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 <code>ENUM</code> @@ -8230,6 +8265,41 @@ namespace odb </tr> </table> + <p>The SQLite ODB runtime library also provides support for mapping the + <code>std::vector<char></code> type to the SQLite BLOB type. + However, this mapping is not enabled by default (by default, + <code>std::vector<char></code> will be treated as a container). + To enable the BLOB mapping for this type we need to specify + the database type explicitly using the <code>db type</code> + pragma (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>), + for example:</p> + + <pre class="c++"> +#pragma db object +class object +{ + ... + + #pragma db type("BLOB") + std::vector<char> buf_; +}; + </pre> + + <p>Alternatively, this can be done on the per-type basis, for example:</p> + + <pre class="c++"> +typedef std::vector<char> buffer; +#pragma db value(buffer) type("BLOB") + +#pragma db object +class object +{ + ... + + buffer buf_; // Mapped to BLOB. +}; + </pre> + <p>Additionally, by default, C++ enumerations are automatically mapped to the SQLite <code>INTEGER</code> type with the default <code>NULL</code> semantics being <code>NOT NULL</code>.</p> @@ -8780,6 +8850,41 @@ class person </tr> </table> + <p>The PostgreSQL ODB runtime library also provides support for mapping the + <code>std::vector<char></code> type to the PostgreSQL BYTEA type. + However, this mapping is not enabled by default (by default, + <code>std::vector<char></code> will be treated as a container). + To enable the BYTEA mapping for this type we need to specify + the database type explicitly using the <code>db type</code> + pragma (<a href="#10.3.3">Section 10.3.3, "<code>type</code>"</a>), + for example:</p> + + <pre class="c++"> +#pragma db object +class object +{ + ... + + #pragma db type("BYTEA") + std::vector<char> buf_; +}; + </pre> + + <p>Alternatively, this can be done on the per-type basis, for example:</p> + + <pre class="c++"> +typedef std::vector<char> buffer; +#pragma db value(buffer) type("BYTEA") + +#pragma db object +class object +{ + ... + + buffer buf_; // Mapped to BYTEA. +}; + </pre> + <p>Additionally, by default, C++ enumerations are automatically mapped to <code>INTEGER</code> with the default <code>NULL</code> semantics being <code>NOT NULL</code>.</p> |