From 4b369b8791efa967911b5e526b210ad570d7ae05 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov The The next three exceptions ( By default, an object pointer can be
@@ -443,17 +444,18 @@ for consistency.
10.2.1 type
- 10.2.2 id_type
+ 10.2.3 not_null
10.2.3 null
/not_null
10.2.4 unordered
10.2.5 index_type
10.2.6 key_type
- 10.2.7 value_type
- 10.2.8 id_column
- 10.2.9 index_column
- 10.2.10 key_column
+ 10.2.11 value_column
+ 10.2.8 value_null
/value_not_null
+ 10.2.9 id_column
+ 10.2.10 index_column
+ 10.2.11 key_column
10.2.12 value_column
10.3.3 type
10.3.4 column
- 10.3.5 transient
+ 10.3.6 not_null
10.3.6 null
/not_null
10.3.7 inverse
10.3.8 unordered
10.3.9 table
10.3.10 index_type
10.3.11 key_type
- 10.3.12 value_type
- 10.3.13 id_column
- 10.3.14 index_column
- 10.3.15 key_column
+ 10.3.16 value_column
+ 10.3.13 value_null
/value_not_null
+ 10.3.14 id_column
+ 10.3.15 index_column
+ 10.3.16 key_column
@@ -2860,7 +2862,8 @@ namespace odb
10.3.17 value_column
null_pointer
exception is thrown when a
pointer to a persistent object declared non-NULL
- with the db not_null
pragma has the NULL
+ with the db not_null
or
+ db value_not_null
pragma has the NULL
value. See Chapter 6, "Relationships" for details.already_in_transaction
,
@@ -3613,12 +3616,12 @@ class person
{
...
private:
- #pragma db table("nicknames") \
- id_column ("person_id") \
- index_type ("SMALLINT UNSIGNED NOT NULL") \
- index_column ("nickname_number") \
- value_type ("VARCHAR(255) NOT NULL") \
- value_column ("nickname")
+ #pragma db table("nicknames") \
+ id_column("person_id") \
+ index_type("SMALLINT UNSIGNED") \
+ index_column("nickname_number") \
+ value_type("VARCHAR(255)") \
+ value_column("nickname")
std::vector<std::string> nicknames_;
...
};
@@ -3701,10 +3704,10 @@ class person
{
...
private:
- #pragma db table("emails") \
- id_column ("person_id") \
- value_type ("VARCHAR(255) NOT NULL") \
- value_column ("email")
+ #pragma db table("emails") \
+ id_column("person_id") \
+ value_type("VARCHAR(255)") \
+ value_column("email")
std::set<std::string> emails_;
...
};
@@ -3763,12 +3766,12 @@ class person
{
...
private:
- #pragma db table("weight_map") \
- id_column ("person_id") \
- key_type ("INT UNSIGNED NOT NULL") \
- key_column ("age") \
- value_type ("DOUBLE NOT NULL") \
- value_column ("weight")
+ #pragma db table("weight_map") \
+ id_column("person_id") \
+ key_type("INT UNSIGNED") \
+ key_column("age") \
+ value_type("DOUBLE") \
+ value_column("weight")
std::map<unsigned short, float> age_weight_map_;
...
};
@@ -3879,8 +3882,13 @@ class employee
NULL
. To
- specify that a pointer always point to a valid object we can
- use the not_null
pragma, for example:not_null
pragma (Section
+ 10.3.6, "null
/not_null
") for
+ single object pointers and the value_not_null
pragma
+ (Section
+ 10.3.13, "value_null
/value_not_null
")
+ for containers of object pointers. For example:
#pragma db object @@ -3889,14 +3897,18 @@ class employee ... #pragma db not_null - shared_ptr<employer> employer_; + shared_ptr<employer> current_employer_; + + #pragma db value_not_null + std::vector<shared_ptr<employer> > previous_employers_; };
In this case, if we perform a database operation on the
- employee
object and the employer_
- pointer is NULL
, then the odb::null_pointer
- exception will be thrown.
employee
object and the current_employer_
+ pointer or one of the pointers stored in the
+ previous_employers_
container is NULL
,
+ then the odb::null_pointer
exception will be thrown.
We don't need to do anything special to establish or navigate a relationship between two persistent objects, as shown in the @@ -4088,7 +4100,7 @@ class employee #pragma db id unsigned long id_; - #pragma db not_null unordered + #pragma db value_not_null unordered std::vector<shared_ptr<project> > projects_; }; @@ -4117,7 +4129,7 @@ class employee { ... - #pragma db not_null unordered \ + #pragma db value_not_null unordered \ id_column("employee_id") value_column("project_name") std::vector<shared_ptr<project> > projects_; }; @@ -4365,7 +4377,7 @@ class employer #pragma db id std::string name_; - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) std::vector<weak_ptr<employee> > employees_ }; @@ -4430,7 +4442,7 @@ class project #pragma db id std::string name_; - #pragma db not_null inverse(projects_) + #pragma db value_not_null inverse(projects_) std::vector<weak_ptr<employee> > employees_; }; @@ -4442,7 +4454,7 @@ class employee #pragma db id unsigned long id_; - #pragma db not_null unordered + #pragma db value_not_null unordered std::vector<shared_ptr<project> > projects_; }; @@ -4492,7 +4504,7 @@ class employer #pragma db id std::string name_; - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) std::vector<weak_ptr<employee> > employees_; }; @@ -4573,7 +4585,7 @@ class employer { ... - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) std::vector<lazy_weak_ptr<employee> > employees_; }; @@ -5060,9 +5072,9 @@ CREATE TABLE person (
The same principle applies when a composite value type is used
as an element of a container, except that instead of
db column
, either the db value_column
- (Section 10.3.16, "value_column
") or
+ (Section 10.3.17, "value_column
") or
db key_column
- (Section 10.3.15, "key_column
")
+ (Section 10.3.16, "key_column
")
pragmas are used to specify the column prefix.
When a composite value type contains a container, an extra table @@ -5094,10 +5106,10 @@ class person
The corresponding database schema will look like this:
-CREATE TABLE `person_name_nicknames` ( - `object_id` BIGINT UNSIGNED NOT NULL, - `index` BIGINT UNSIGNED NOT NULL, - `value` TEXT NOT NULL) +CREATE TABLE person_name_nicknames ( + object_id BIGINT UNSIGNED NOT NULL, + index BIGINT UNSIGNED NOT NULL, + value TEXT NOT NULL) CREATE TABLE person ( id BIGINT UNSIGNED NOT NULL PRIMARY KEY, @@ -5132,10 +5144,10 @@ class person@@ -6485,10 +6570,9 @@ private: class person { ... -private: + #pragma db id auto unsigned long id_; - ... }; @@ -6512,13 +6596,16 @@ private: class person { ... -private: - #pragma db type("INT NOT NULL") + + #pragma db type("INT") bool married_; - ... }; +This will result in the following schema changes:
-CREATE TABLE `person_nickname` ( - `object_id` BIGINT UNSIGNED NOT NULL, - `index` BIGINT UNSIGNED NOT NULL, - `value` TEXT NOT NULL) +CREATE TABLE person_nickname ( + object_id BIGINT UNSIGNED NOT NULL, + index BIGINT UNSIGNED NOT NULL, + value TEXT NOT NULL)Similar to columns, we can make the table prefix empty.
@@ -5361,7 +5373,7 @@ CREATE TABLE permanent_employee ( CREATE TABLE temporary_employee ( first TEXT NOT NULL, - last` TEXT NOT NULL, + last TEXT NOT NULL, id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, duration BIGINT UNSIGNED NOT NULL); @@ -5688,7 +5700,7 @@ namespace db named value type pragma to map a C++ type to a native database type:-#pragma db value(bool) type("INT NOT NULL") +#pragma db value(bool) type("INT") #pragma db object class person @@ -6024,8 +6036,8 @@ private:+- @@ -6054,27 +6066,33 @@ private:- not_null
object pointer cannot be +NULL
+ null
/not_null
type can/cannot be NULL
10.2.3 + + ++ value_null
/value_not_null
container's value can/cannot be +NULL
10.2.8 +id_column
column name for a container's table object id -10.2.8 +10.2.9 index_column
column name for a container's table index -10.2.9 +10.2.10 key_column
column name for a container's table key -10.2.10 +10.2.11 @@ -6095,15 +6113,14 @@ private: that should be used for data members of this type. For example: value_column
column name for a container's table value -10.2.11 +10.2.12 -#pragma db value(bool) type("INT NOT NULL") +#pragma db value(bool) type("INT") #pragma db object class person { ... -private: + bool married_; // Mapped to INT NOT NULL database type. - ... };@@ -6111,7 +6128,10 @@ private: types, such asbool
,int
, andstd::string
and the database types for each supported database system. For more information on the default mapping, - refer to Part II, "Database Systems". + refer to Part II, "Database Systems". The +null
andnot_null
(Section + 10.2.3, "null
/not_null
") specifiers + can be used to control the NULL semantics of a type.In the above example we changed the mapping for the
bool
type which is now mapped to theINT
database type. In @@ -6124,7 +6144,7 @@ private: boolean value is stored in the database as a string:-#pragma db value(bool) type("VARCHAR(5) NOT NULL") +#pragma db value(bool) type("VARCHAR(5)")The possible database values for the C++
true
value could @@ -6149,14 +6169,13 @@ private: example:-#pragma db value(std::string) type("TEXT NOT NULL") \ - id_type("VARCHAR(128) NOT NULL") +#pragma db value(std::string) type("TEXT") id_type("VARCHAR(128)") #pragma db object class person { ... -private: + #pragma db id std::string email_; // Mapped to VARCHAR(128) NOT NULL. @@ -6173,43 +6192,72 @@ private: class person { ... -private: - #pragma db id type("VARCHAR(128) NOT NULL") + + #pragma db id type("VARCHAR(128)") std::string email_; - ... };-10.2.3
+not_null
10.2.3
-null
/not_null
The
+not_null
specifier specifies that an object pointer - or a container of object pointers cannot have or contain the -NULL
value. For example:The
null
andnot_null
specifiers specify that + a value type or object pointer can or cannot beNULL
, + respectively. By default, value types are assumed not to allow +NULL
values while object pointers are assumed to + allowNULL
values. Data members of types that allow +NULL
values are mapped in a relational database to + columns that allowNULL
values. For example:using std::tr1::shared_ptr; +typedef shared_ptr<std::string> string_ptr; +#pragma db value(string_ptr) type("TEXT") null + #pragma db object class person { ... + + string_ptr name_; // Mapped to TEXT NULL. }; typedef shared_ptr<person> person_ptr; #pragma db value(person_ptr) not_null +-#pragma db object -class account -{ - ... -}; +The
-typedef std::vector<shared_ptr<account> > accounts; -#pragma db value(accounts) not_null -NULL
semantics can also be specified on the + per-member basis (Section 10.3.6, + "null
/not_null
"). If both a type and + a member havenull
/not_null
specifiers, + then the member specifier takes precedence. If a member specifier + relaxes theNULL
semantics (that is, if a member has + thenull
specifier and the type has the explicit +not_null
specifier), then a warning is issued.It is also possible to override a previously specified +
+ +null
/not_null
specifier. This is + primarily useful if a third-party type, for example, + one provided by a profile library (Part III, + "Profiles"), allowsNULL
values but in your + object model data members of this type should never be +NULL
. In this case you can use thenot_null
+ specifier to disableNULL
values for this type for the + entire translation unit. For example:+// By default, null_string allows NULL values. +// +#include <null-string.hxx> + +// Disable NULL values for all the null_string data members. +// +#pragma db value(null_string) not_null +-For a more detailed discussion of the
+NULL
object pointer - semantics, refer to Chapter 6, "Relationships".For a more detailed discussion of the
NULL
semantics + for the object pointers, refer to Chapter 6, + "Relationships".10.2.4
@@ -6239,7 +6287,7 @@ typedef std::vector<std::string> names;unordered
typedef std::vector<std::string> names; -#pragma db value(names) index_type("SMALLINT UNSIGNED NOT NULL") +#pragma db value(names) index_type("SMALLINT UNSIGNED")10.2.6
@@ -6253,7 +6301,7 @@ typedef std::vector<std::string> names;key_type
typedef std::map<unsigned short, float> age_weight_map; -#pragma db value(age_weight_map) key_type("INT UNSIGNED NOT NULL") +#pragma db value(age_weight_map) key_type("INT UNSIGNED")10.2.7
@@ -6267,10 +6315,42 @@ typedef std::map<unsigned short, float> age_weight_map;value_type
typedef std::vector<std::string> names; -#pragma db value(names) value_type("VARCHAR(255) NOT NULL") +#pragma db value(names) value_type("VARCHAR(255)")-10.2.8
+id_column
The
+ +value_null
andvalue_not_null
+ (Section 10.2.8, + "value_null
/value_not_null
") specifiers + can be used to control the NULL semantics of a value column.10.2.8
+ +value_null
/value_not_null
The
+ +value_null
andvalue_not_null
specifiers + specify that a container type's element value can or cannot be +NULL
, respectively. The semantics ofvalue_null
+ andvalue_not_null
are similar to that of the +null
andnot_null
specifiers + (Section 10.2.3, "null
/not_null
"). + For example:+using std::tr1::shared_ptr; + +#pragma db object +class account +{ + ... +}; + +typedef std::vector<shared_ptr<account> > accounts; +#pragma db value(accounts) value_not_null ++ +For set and multiset containers (Section 5.2, "Set and + Multiset Containers") the element value is automatically treated + as not alowing a
+ +NULL
value.10.2.9
id_column
The
id_column
specifier specifies the column name that should be used to store the object id in a @@ -6284,7 +6364,7 @@ typedef std::vector<std::string> names;If the column name is not specified, then
-object_id
is used by default.10.2.9
+index_column
10.2.10
index_column
The
index_column
specifier specifies the column name that should be used to store the element index in an @@ -6298,7 +6378,7 @@ typedef std::vector<std::string> names;If the column name is not specified, then
-index
is used by default.10.2.10
+key_column
10.2.11
key_column
The
key_column
specifier specifies the column name that should be used to store the key in a map @@ -6312,7 +6392,7 @@ typedef std::map<unsigned short, float> age_weight_map;If the column name is not specified, then
-key
is used by default.10.2.11
+value_column
10.2.12
value_column
The
value_column
specifier specifies the column name that should be used to store the element value in a @@ -6375,8 +6455,8 @@ typedef std::map<unsigned short, float> age_weight_map;- @@ -6418,27 +6498,33 @@ typedef std::map<unsigned short, float> age_weight_map;- not_null
object pointer cannot be NULL ++ null
/not_null
member can/cannot be NULL 10.3.6 + + ++ value_null
/value_not_null
container's value can/cannot be NULL +10.3.13 +id_column
column name for a container's object id -10.3.13 +10.3.14 index_column
column name for a container's index -10.3.14 +10.3.15 key_column
column name for a container's key -10.3.15 +10.3.16 @@ -6464,10 +6550,9 @@ typedef std::map<unsigned short, float> age_weight_map; class person { ... -private: + #pragma db id std::string email_; - ... }; value_column
column name for a container's value -10.3.16 +10.3.17
The null
and not_null
(Section
+ 10.3.6, "null
/not_null
") specifiers
+ can be used to control the NULL semantics of a data member.
column
The column
specifier specifies the column name
@@ -6530,10 +6617,9 @@ private:
class person
{
...
-private:
+
#pragma db id column("person_id")
unsigned long id_;
- ...
};
@@ -6555,12 +6641,11 @@ private:
class person
{
...
-private:
+
date born_;
#pragma db transient
unsigned short age_; // Computed from born_.
- ...
};
@@ -6568,11 +6653,23 @@ private:
references that are only meaningful in the application's
memory, as well as utility members such as mutexes, etc.
not_null
The not_null
specifier specifies that a data member of
- an object pointer or a container of object pointers type cannot
- have or contain the NULL
value. For example:
null
/not_null
The null
and not_null
specifiers specify that
+ a data member can or cannot be NULL
, respectively.
+ By default, data members of basic value types for which database
+ mapping is provided by the ODB compiler do not allow NULL
+ values while data members of object pointers allow NULL
+ values. Other value types, such as those provided by the profile
+ libraries (Part III, "Profiles"), may or may
+ not allow NULL
values, depending on the semantics
+ of each value type. Consult the relevant documentation to find
+ out more about the NULL
semantics for such value
+ types. A data member containing the object id (Section
+ 10.3.1, "id
" ) is automatically treated as not
+ allowing a NULL
value. Data members that
+ allow NULL
values are mapped in a relational database
+ to columns that allow NULL
values. For example:
using std::tr1::shared_ptr; @@ -6581,24 +6678,33 @@ using std::tr1::shared_ptr; class person { ... + + #pragma db null + std::string name_; }; #pragma db object class account { ... -private: - #pragma db not_null - shared_ptr<person> primary_holder_; #pragma db not_null - std::vector<shared_ptr<person> > secondary_holders_; - ... + shared_ptr<person> holder_; };-
For a more detailed discussion of the NULL
object pointer
- semantics, refer to Chapter 6, "Relationships".
The NULL
semantics can also be specified on the
+ per-type basis (Section 10.2.3,
+ "null
/not_null
"). If both a type and
+ a member have null
/not_null
specifiers,
+ then the member specifier takes precedence. If a member specifier
+ relaxes the NULL
semantics (that is, if a member has
+ the null
specifier and the type has the explicit
+ not_null
specifier), then a warning is issued.
For a more detailed discussion of the NULL
semantics
+ for the object pointers, refer to Chapter 6,
+ "Relationships".
inverse
The value_null
and value_not_null
+ (Section 10.3.13,
+ "value_null
/value_not_null
") specifiers
+ can be used to control the NULL semantics of a value column.
value_null
/value_not_null
The value_null
and value_not_null
specifiers
+ specify that a container's element value for a data member can or
+ cannot be NULL
, respectively. The semantics of
+ value_null
and value_not_null
are similar
+ to that of the null
and not_null
specifiers
+ (Section 10.3.6, "null
/not_null
").
+ For example:
+using std::tr1::shared_ptr; + +#pragma db object +class person +{ + ... +}; + +#pragma db object +class account +{ ... + + #pragma db value_not_null + std::vector<shared_ptr<person> > holders_; };-
id_column
For set and multiset containers (Section 5.2, "Set and
+ Multiset Containers") the element value is automatically treated
+ as not allowing a NULL
value.
id_column
The id_column
specifier specifies the column
name that should be used to store the object id in a
@@ -6778,17 +6915,16 @@ private:
class person
{
...
-private:
+
#pragma db id_column("person_id")
std::vector<std::string> nicknames_;
- ...
};
If the column name is not specified, then object_id
is used by default.
index_column
index_column
The index_column
specifier specifies the column
name that should be used to store the element index in an
@@ -6803,17 +6939,16 @@ private:
class person
{
...
-private:
+
#pragma db index_column("nickname_number")
std::vector<std::string> nicknames_;
- ...
};
If the column name is not specified, then index
is used by default.
key_column
key_column
The key_column
specifier specifies the column
name that should be used to store the key in a map
@@ -6828,17 +6963,16 @@ private:
class person
{
...
-private:
+
#pragma db key_column("age")
std::map<unsigned short, float> age_weight_map_;
- ...
};
If the column name is not specified, then key
is used by default.
value_column
value_column
The value_column
specifier specifies the column
name that should be used to store the element value in a
@@ -6853,10 +6987,9 @@ private:
class person
{
...
-private:
+
#pragma db value_column("weight")
std::map<unsigned short, float> age_weight_map_;
- ...
};
@@ -6888,10 +7021,9 @@ PRAGMA_DB(object)
class person
{
...
-private:
+
PRAGMA_DB(id)
unsigned long id_;
- ...
};
@@ -6904,9 +7036,8 @@ private:
class person
{
...
-private:
+
unsigned long id_;
- ...
};
#ifdef ODB_COMPILER
@@ -6956,10 +7087,9 @@ g++ -Wall -Wno-unknown-pragmas ...
class person
{
...
-private:
+
#pragma db id
unsigned long id_;
- ...
};
#pragma warning (pop)
@@ -7045,81 +7175,97 @@ aCC +W2161 ...
NULL
Semanticsbool
TINYINT(1) NOT NULL
TINYINT(1)
NOT NULL
char
TINYINT NOT NULL
TINYINT
NOT NULL
signed char
TINYINT NOT NULL
TINYINT
NOT NULL
unsigned char
TINYINT UNSIGNED NOT NULL
TINYINT UNSIGNED
NOT NULL
short
SMALLINT NOT NULL
SMALLINT
NOT NULL
unsigned short
SMALLINT UNSIGNED NOT NULL
SMALLINT UNSIGNED
NOT NULL
int
INT NOT NULL
INT
NOT NULL
unsigned int
INT UNSIGNED NOT NULL
INT UNSIGNED
NOT NULL
long
BIGINT NOT NULL
BIGINT
NOT NULL
unsigned long
BIGINT UNSIGNED NOT NULL
BIGINT UNSIGNED
NOT NULL
long long
BIGINT NOT NULL
BIGINT
NOT NULL
unsigned long long
BIGINT UNSIGNED NOT NULL
BIGINT UNSIGNED
NOT NULL
float
FLOAT NOT NULL
FLOAT
NOT NULL
double
DOUBLE NOT NULL
DOUBLE
NOT NULL
std::string
TEXT NOT NULL/VARCHAR(255) NOT NULL
TEXT/VARCHAR(255)
NOT NULL
std::string
is mapped
- to the VARCHAR(255) NOT NULL
MySQL type. Otherwise,
- it is mapped to TEXT NOT NULL
.
+ to the VARCHAR(255)
MySQL type. Otherwise,
+ it is mapped to TEXT
.
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 NOT
- NULL
type. All other enumerations are mapped to INT
- NOT NULL
or INT UNSIGNED NOT NULL
. For example:
ENUM
+ type. All other enumerations are mapped to INT
or
+ INT UNSIGNED
. In both cases the default NULL
+ semantics is NOT NULL
. For example:
enum color {red, green, blue}; @@ -7540,86 +7687,103 @@ namespace odb@@ -8872,21 +9057,25 @@ class personC++ Type SQLite Type +Default NULL
Semantics- bool
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- char
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- signed char
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned char
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- short
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned short
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- int
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned int
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- long
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned long
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- long long
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned long long
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- float
+ REAL NOT NULL
+ REAL
NOT NULL
- double
+ REAL NOT NULL
+ REAL
NOT NULL
- std::string
+ TEXT NOT NULL
+ TEXT
NOT NULL
Additionally, by default, C++ enumerations are automatically mapped to - the SQLite
+ the SQLiteINTEGER NOT NULL
type.INTEGER
type with the defaultNULL
+ semantics beingNOT NULL
.Note also that SQLite only operates with signed integers and the largest value that an SQLite database can store is a signed 64-bit integer. As @@ -8073,86 +8237,103 @@ class person
C++ Type PostgreSQL Type +Default NULL
Semantics- bool
+ BOOLEAN NOT NULL
+ BOOLEAN
NOT NULL
- char
+ SMALLINT NOT NULL
+ SMALLINT
NOT NULL
- signed char
+ SMALLINT NOT NULL
+ SMALLINT
NOT NULL
- unsigned char
+ SMALLINT NOT NULL
+ SMALLINT
NOT NULL
short
+ SMALLINT NULL
NOT NULL
- unsigned short
+ SMALLINT NOT NULL
+ SMALLINT
NOT NULL
- int
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- unsigned int
+ INTEGER NOT NULL
+ INTEGER
NOT NULL
- long
+ BIGINT NOT NULL
+ BIGINT
NOT NULL
- unsigned long
+ BIGINT NOT NULL
+ BIGINT
NOT NULL
- long long
+ BIGINT NOT NULL
+ BIGINT
NOT NULL
- unsigned long long
+ BIGINT NOT NULL
+ BIGINT
NOT NULL
- float
+ REAL NOT NULL
+ REAL
NOT NULL
- double
+ DOUBLE PRECISION NOT NULL
+ DOUBLE PRECISION
NOT NULL
- std::string
+ TEXT NOT NULL
+ TEXT
NOT NULL
Additionally, by default, C++ enumerations are automatically - mapped to
+ mapped toINTEGER NOT NULL
.INTEGER
with the defaultNULL
+ semantics beingNOT NULL
.Note also that because PostgreSQL does not support unsigned integers, the
unsigned short
,unsigned int
, and @@ -8815,21 +8996,25 @@ namespace odbBoost date_time
TypeMySQL Type +Default NULL
Semanticsgregorian::date
+ DATE
NULL
posix_time::ptime
+ DATETIME
NULL
@@ -8848,7 +9033,7 @@ namespace odb class person { ... - #pragma db type("TIMESTAMP") + #pragma db type("TIMESTAMP") not_null boost::posix_time::ptime updated_; }; posix_time::time_duration
+ TIME
NULL
date_time
TypeNULL
Semanticsgregorian::date
TEXT
NULL
posix_time::ptime
TEXT
NULL
posix_time::time_duration
TEXT
NULL
NULL
SemanticsQString
TEXT
TEXT/VARCHAR(255)
NULL
QByteArray
BLOB
NULL
QString
is mapped
- to the VARCHAR(255) NOT NULL
MySQL type. Otherwise,
+ to the VARCHAR(255)
MySQL type. Otherwise,
it is mapped to TEXT
.
@@ -9032,16 +9224,19 @@ class Person
NULL
SemanticsQString
TEXT
NULL
QByteArray
BLOB
NULL
NULL
SemanticsQDate
DATE
NULL
QTime
TIME
NULL
QDateTime
DATETIME
NULL
NULL
SemanticsQDate
TEXT
NULL
QTime
TEXT
NULL
QDateTime
TEXT
NULL