From 2b460af3796203056f0a8a75017601e6e45e2906 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Dec 2010 15:11:19 +0200 Subject: Document not_null pragma --- doc/manual.xhtml | 197 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 134 insertions(+), 63 deletions(-) diff --git a/doc/manual.xhtml b/doc/manual.xhtml index 52f448d..aa58a86 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -348,14 +348,15 @@ for consistency. 5.3Value Type Pragmas - - - - - - - - + + + + + + + + +
5.3.1type
5.3.2unordered
5.3.3index_type
5.3.4key_type
5.3.5value_type
5.3.6id_column
5.3.7index_column
5.3.8key_column
5.3.9value_column
5.3.2not_null
5.3.3unordered
5.3.4index_type
5.3.5key_type
5.3.6value_type
5.3.7id_column
5.3.8index_column
5.3.9key_column
5.3.10value_column
@@ -367,16 +368,17 @@ for consistency. 5.4.3type 5.4.4column 5.4.5transient - 5.4.6inverse - 5.4.7unordered - 5.4.8table - 5.4.9index_type - 5.4.10key_type - 5.4.11value_type - 5.4.12id_column - 5.4.13index_column - 5.4.14key_column - 5.4.15value_column + 5.4.6not_null + 5.4.7inverse + 5.4.8unordered + 5.4.9table + 5.4.10index_type + 5.4.11key_type + 5.4.12value_type + 5.4.13id_column + 5.4.14index_column + 5.4.15key_column + 5.4.16value_column @@ -3539,51 +3541,57 @@ class person + 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 value_column the column name for the container's table value - 5.3.9 + 5.3.10 @@ -3646,7 +3654,35 @@ private: mapping example in the odb-examples package shows how to do this for all the supported database systems.

-

5.3.2 unordered

+

5.3.2 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
+
+ +

5.3.3 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 -

5.3.3 index_type

+

5.3.4 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") -

5.3.4 key_type

+

5.3.5 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") -

5.3.5 value_type

+

5.3.6 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") -

5.3.6 id_column

+

5.3.7 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.

-

5.3.7 index_column

+

5.3.8 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.

-

5.3.8 key_column

+

5.3.9 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.

-

5.3.9 value_column

+

5.3.10 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 + object pointer cannot be NULL + 5.4.6 + + + inverse the member is an inverse side of a bidirectional relationship - 5.4.6 + 5.4.7 unordered ordered container should be stored unordered - 5.4.7 + 5.4.8 table the table name for the container - 5.4.8 + 5.4.9 index_type the database type for the container's index type - 5.4.9 + 5.4.10 key_type the database type for the container's key type - 5.4.10 + 5.4.11 value_type the database type for the container's value type - 5.4.11 + 5.4.12 id_column the column name for the container's table object id - 5.4.12 + 5.4.13 index_column the column name for the container's table index - 5.4.13 + 5.4.14 key_column the column name for the container's table key - 5.4.14 + 5.4.15 value_column the column name for the container's table value - 5.4.15 + 5.4.16 @@ -3989,13 +4031,42 @@ private: references that are only meaningful in the application's memory, as well as utility members such as mutexes, etc.

-

5.4.6 inverse

+

5.4.6 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_;
+  ...
+};
+
+ +

5.4.7 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:

+ an object pointer or a container of object 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: };

-

5.4.8 table

+

5.4.9 table

The table specifier specifies the table name that should be used to store the contents of the container member. For example:

@@ -4076,7 +4147,7 @@ private: above, without the table specifier, the container's table name would have been person_nicknames.

-

5.4.9 index_type

+

5.4.10 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: }; -

5.4.10 key_type

+

5.4.11 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: }; -

5.4.11 value_type

+

5.4.12 value_type

The value_type specifier specifies the native database type that should be used for the container's @@ -4139,14 +4210,14 @@ private: }; -

5.4.12 id_column

+

5.4.13 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 of index_column are similar to that of the column 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 of key_column are similar to that of the column 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 of value_column are similar to that of the column specifier (see - Section 5.4.4, "column"). + Section 5.4.4, "column"). For example:

-- 
cgit v1.1