From 2709ab07167efffddd65f772ff99361bba30b006 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov 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
.
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
.