From 2b460af3796203056f0a8a75017601e6e45e2906 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov 5.3 Value Type Pragmas
@@ -367,16 +368,17 @@ for consistency.
- 5.3.1 type
- 5.3.2 unordered
- 5.3.3 index_type
- 5.3.4 key_type
- 5.3.5 value_type
- 5.3.6 id_column
- 5.3.7 index_column
- 5.3.8 key_column
+ 5.3.9 value_column
+ 5.3.2 not_null
+ 5.3.3 unordered
+ 5.3.4 index_type
+ 5.3.5 key_type
+ 5.3.6 value_type
+ 5.3.7 id_column
+ 5.3.8 index_column
+ 5.3.9 key_column
5.3.10 value_column
5.4.3 type
5.4.4 column
- 5.4.5 transient
- 5.4.6 inverse
- 5.4.7 unordered
- 5.4.8 table
- 5.4.9 index_type
- 5.4.10 key_type
- 5.4.11 value_type
- 5.4.12 id_column
- 5.4.13 index_column
- 5.4.14 key_column
+ 5.4.15 value_column
+ 5.4.6 not_null
+ 5.4.7 inverse
+ 5.4.8 unordered
+ 5.4.9 table
+ 5.4.10 index_type
+ 5.4.11 key_type
+ 5.4.12 value_type
+ 5.4.13 id_column
+ 5.4.14 index_column
+ 5.4.15 key_column
@@ -3539,51 +3541,57 @@ class person
5.4.16 value_column
+
+
+
+ not_null
object pointer cannot be
+ NULL
5.3.2
+
unordered
ordered container should be stored unordered
- 5.3.2
+ 5.3.3
index_type
the database type for the container's index type
- 5.3.3
+ 5.3.4
key_type
the database type for the container's key type
- 5.3.4
+ 5.3.5
value_type
the database type for the container's value type
- 5.3.5
+ 5.3.6
id_column
the column name for the container's table object id
- 5.3.6
+ 5.3.7
index_column
the column name for the container's table index
- 5.3.7
+ 5.3.8
key_column
the column name for the container's table key
- 5.3.8
+ 5.3.9
@@ -3646,7 +3654,35 @@ private:
value_column
the column name for the container's table value
- 5.3.9
+ 5.3.10
mapping
example in the odb-examples
package shows how to do this for all the supported database systems.
unordered
not_null
The not_null
specifier specifies that an object pointer
+ or a container of object pointers type cannot have or contain the
+ NULL
value. For example:
+using std::tr1::shared_ptr; + +#pragma db object +class person +{ + ... +}; + +typedef shared_ptr<person> person_ptr; +#pragma db value(person_ptr) not_null + +#pragma db object +class account +{ + ... +}; + +typedef std::vector<shared_ptr<account> > accounts; +#pragma db value(accounts) not_null ++ +
unordered
The unordered
specifier specifies that the ordered
container should be stored in the database unordered. The database
@@ -3659,7 +3695,7 @@ typedef std::vector<std::string> names;
#pragma db value(names) unordered
-
index_type
index_type
The index_type
specifier specifies the native
database type that should be used for the ordered container's
@@ -3673,7 +3709,7 @@ typedef std::vector<std::string> names;
#pragma db value(names) index_type("SMALLINT UNSIGNED NOT NULL")
-
key_type
key_type
The key_type
specifier specifies the native
database type that should be used for the map container's
@@ -3687,7 +3723,7 @@ typedef std::map<unsigned short, float> age_weight_map;
#pragma db value(age_weight_map) key_type("INT UNSIGNED NOT NULL")
-
value_type
value_type
The value_type
specifier specifies the native
database type that should be used for the container's
@@ -3701,7 +3737,7 @@ typedef std::vector<std::string> names;
#pragma db value(names) value_type("VARCHAR(255) NOT NULL")
-
id_column
id_column
The id_column
specifier specifies the column
name that should be used to store the object id in the
@@ -3715,7 +3751,7 @@ typedef std::vector<std::string> names;
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 the
@@ -3729,7 +3765,7 @@ typedef std::vector<std::string> names;
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 the map
@@ -3743,7 +3779,7 @@ typedef 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 the
@@ -3806,64 +3842,70 @@ typedef std::map<unsigned short, float> age_weight_map;
not_null
inverse
unordered
table
index_type
key_type
value_type
id_column
index_column
key_column
value_column
inverse
not_null
The not_null
specifier specifies that the member of
+ an object pointer or a container of object pointers type cannot
+ have or contain the NULL
value. For example:
+using std::tr1::shared_ptr; + +#pragma db object +class person +{ + ... +}; + +#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_; + ... +}; ++ +
inverse
The inverse
specifier specifies that the member of
- a pointer or a container of pointers type is an inverse side of
- a bidirectional object relationship. The single required argument
- to this specifier is the data member name in the referenced object.
- For example:
using std::tr1::shared_ptr; @@ -4029,9 +4100,9 @@ private: information. Only ordered and set containers can be used for inverse members. If an inverse member is of an ordered container type, it is automatically marked as unordered (see - Section 5.4.7, "-unordered
"). + Section 5.4.8, "unordered
"). -5.4.7
+unordered
5.4.8
unordered
The
unordered
specifier specifies that the member of an ordered container type should be stored in the database unordered. @@ -4051,7 +4122,7 @@ private: };
table
table
The table
specifier specifies the table name that should
be used to store the contents of the container member. For example:
table
specifier, the container's
table name would have been person_nicknames
.
- index_type
index_type
The index_type
specifier specifies the native
database type that should be used for the ordered container's
@@ -4097,7 +4168,7 @@ private:
};
-
key_type
key_type
The key_type
specifier specifies the native
database type that should be used for the map container's
@@ -4118,7 +4189,7 @@ private:
};
-
value_type
value_type
The value_type
specifier specifies the native
database type that should be used for the container's
@@ -4139,14 +4210,14 @@ private:
};
-
id_column
id_column
The id_column
specifier specifies the column
name that should be used to store the object id in the
container's table for the member. The semantics of
id_column
are similar to that of the
column
specifier (see
- Section 5.4.4, "column
").
+ Section 5.4.4, "column
").
For example:
@@ -4164,14 +4235,14 @@ private:If the column name is not specified, then
-object_id
is used by default.5.4.13
+index_column
5.4.14
index_column
The
index_column
specifier specifies the column name that should be used to store the element index in the ordered container's table for the member. The semantics ofindex_column
are similar to that of thecolumn
specifier (see - Section 5.4.4, "column
"). + Section 5.4.4, "column
"). For example:@@ -4189,14 +4260,14 @@ private:If the column name is not specified, then
-index
is used by default.5.4.14
+key_column
5.4.15
key_column
The
key_column
specifier specifies the column name that should be used to store the key in the map container's table for the member. The semantics ofkey_column
are similar to that of thecolumn
specifier (see - Section 5.4.4, "column
"). + Section 5.4.4, "column
"). For example:@@ -4214,14 +4285,14 @@ private:If the column name is not specified, then
-key
is used by default.5.4.15
+value_column
5.4.16
value_column
The
value_column
specifier specifies the column name that should be used to store the element value in the container's table for the member. The semantics ofvalue_column
are similar to that of thecolumn
specifier (see - Section 5.4.4, "column
"). + Section 5.4.4, "column
"). For example:-- cgit v1.1