From d7d0e1067b690f08006bb57149e204f4b9ddb99c Mon Sep 17 00:00:00 2001
From: Boris Kolpackov 12.4.11 readonly
12.4.12 inverse
- 12.4.13 version
- 12.4.14 unordered
- 12.4.15 table
- 12.4.16 index_type
- 12.4.17 key_type
- 12.4.18 value_type
- 12.4.19 value_null
/value_not_null
- 12.4.20 id_options
- 12.4.21 index_options
- 12.4.22 key_options
- 12.4.23 value_options
- 12.4.24 id_column
- 12.4.25 index_column
- 12.4.26 key_column
+ 12.4.27 value_column
+ 12.4.14 index
+ 12.4.15 unique
+ 12.4.16 unordered
+ 12.4.17 table
+ 12.4.18 index_type
+ 12.4.19 key_type
+ 12.4.20 value_type
+ 12.4.21 value_null
/value_not_null
+ 12.4.22 id_options
+ 12.4.23 index_options
+ 12.4.24 key_options
+ 12.4.25 value_options
+ 12.4.26 id_column
+ 12.4.27 index_column
+ 12.4.28 key_column
@@ -541,17 +543,20 @@ for consistency.
12.4.29 value_column
-
12.6 Database Type Mapping Pragmas
+ 12.6 Index Definition Pragmas
-
+ 12.7 C++ Compiler Warnings
+ 12.7 Database Type Mapping Pragmas
+
+
@@ -577,6 +582,7 @@ for consistency.
+ 12.8 C++ Compiler Warnings
-
- 12.7.1 GNU C++
- 12.7.2 Visual C++
- 12.7.3 Sun C++
- 12.7.4 IBM XL C++
- 12.7.5 HP aC++
+ 12.7.6 Clang
+ 12.8.1 GNU C++
+ 12.8.2 Visual C++
+ 12.8.3 Sun C++
+ 12.8.4 IBM XL C++
+ 12.8.5 HP aC++ 12.8.6 Clang
@@ -599,6 +605,7 @@ for consistency.
+ 13.6 MySQL Index Definition
@@ -622,6 +629,7 @@ for consistency.
+ 14.6 SQLite Index Definition
@@ -646,6 +654,7 @@ for consistency.
+ 15.6 PostgreSQL Index Definition
@@ -669,6 +678,7 @@ for consistency.
+ 16.6 Oracle Index Definition
@@ -4575,7 +4585,12 @@ private:
The second column contains the element index within a container.
And the last column contains the element value. If the object
id or element value are composite, then, instead of a single
- column, they can occupy multiple columns.17.6 SQL Server Index Definition
Consider the following persistent object as an example:
@@ -4629,7 +4644,7 @@ private: of person's nicknames is probably not important. To instruct the ODB compiler to ignore the order in ordered containers we can use thedb unordered
pragma (Section 12.3.7,
- "unordered
", Section 12.4.14,
+ "unordered
", Section 12.4.16,
"unordered
"). For example:
@@ -4666,7 +4681,11 @@ private: persistent class instance of which the container is a member. And the second column contains the element value. If the object id or element value are composite, then, instead of a single - column, they can occupy multiple columns. + column, they can occupy multiple columns. ODB compiler also + defines an index on a set container table for the object id + column(s). Refer to Section 12.6, "Index Definition + Pragmas" for more information on how to customize this + index.@@ -11089,7 +11125,7 @@ class person relationship 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 - (Section 12.4.14, "Consider the following persistent object as an example:
@@ -4729,7 +4748,11 @@ private: The second column contains the element key. And the last column contains the element value. If the object id, element key, or element value are composite, then instead of a single column - they can occupy multiple columns. + they can occupy multiple columns. ODB compiler also + defines an index on a map container table for the object id + column(s). Refer to Section 12.6, "Index Definition + Pragmas" for more information on how to customize this + index.Consider the following persistent object as an example:
@@ -4887,8 +4910,8 @@ class employee use thenot_null
pragma (Section 12.4.5, "null
/not_null
") for single object pointers and thevalue_not_null
pragma - (Section - 12.4.19, "value_null
/value_not_null
") + (Section + 12.4.21, "value_null
/value_not_null
") for containers of object pointers. For example:@@ -5345,7 +5368,7 @@ CREATE TABLE employee ( pointer. Also note that an ordered container (Section 5.1, "Ordered Containers") of pointers that is an inverse side of a bidirectional relationship is always treated as unordered - (Section 12.4.14, "unordered
") + (Section 12.4.16, "unordered
") because the contents of such a container are implicitly built from the direct side of the relationship which does not contain the element order (index). @@ -6238,9 +6261,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 thedb value_column
- (Section 12.4.27, "value_column
") or + (Section 12.4.29, "value_column
") ordb key_column
- (Section 12.4.26, "key_column
") + (Section 12.4.28, "key_column
") pragmas are used to specify the column prefix.When a composite value type contains a container, an extra table @@ -6284,8 +6307,8 @@ CREATE TABLE person (
To customize the container table name we can use the -
+db table
pragma (Section - 12.4.15, "table
"), for example:db table
pragma (Section + 12.4.17, "table
"), for example:#pragma db value @@ -8873,18 +8896,19 @@ for (bool done (false); !done; )@@ -10879,14 +10915,14 @@ class person std::string first_; // TEXT NOT NULL COLLATE binary - #pragma db options("UNIQUE") - std::string last_; // TEXT NOT NULL COLLATE binary UNIQUE + #pragma db options("CHECK(email != '')") + std::string last_; // TEXT NOT NULL COLLATE binary CHECK(email != '') #pragma db options() std::string title_; // TEXT NOT NULL - #pragma db options() options("UNIQUE") - std::string email_; // TEXT NOT NULL UNIQUE + #pragma db options() options("CHECK(email != '')") + std::string email_; // TEXT NOT NULL CHECK(email != '') };The qualifier tells the ODB compiler what kind of C++ construct this pragma describes. Valid qualifiers are
+ a C++ namespace. Theobject
,view
,value
,member
, -namespace
, andmap
. A pragma with the -object
qualifier describes a persistent object type. It - tells the ODB compiler that the C++ class it describes is a persistent - class. Similarly, pragmas with theview
qualifier describe - view types, thevalue
qualifier describes value types - and themember
qualifier is used to describe data - members of persistent object, view, and value types. The -namespace
qualifier is used to describe common +namespace
,index
, andmap
. + A pragma with theobject
qualifier describes a persistent + object type. It tells the ODB compiler that the C++ class it describes + is a persistent class. Similarly, pragmas with theview
+ qualifier describe view types, thevalue
qualifier + describes value types and themember
qualifier is used + to describe data members of persistent object, view, and value types. + Thenamespace
qualifier is used to describe common properties of objects, views, and value types that belong to - a C++ namespace. Themap
qualifier describes a - mapping between additional database types and types for - which ODB provides built-in support.index
qualifier defines a + database index. And, finally, themap
qualifier + describes a mapping between additional database types and types + for which ODB provides built-in support.The specifier informs the ODB compiler about a particular database-related property of the C++ declaration. For example, the @@ -9024,7 +9048,7 @@ class person the C++ compiler to build the application. Some C++ compilers issue warnings about pragmas that they do not recognize. There are several ways to deal with this problem which are covered - at the end of this chapter in Section 12.7, + at the end of this chapter in Section 12.8, "C++ Compiler Warnings".
12.1 Object Type Pragmas
@@ -10269,7 +10293,7 @@ typedef std::vector<std::string> nicknames;The semantics of the
@@ -10286,7 +10310,7 @@ typedef std::vector<std::string> nicknames;id_options
specifier for a container type are similar to those of theid_options
specifier for - a container data member (Section 12.4.20, + a container data member (Section 12.4.22, "id_options
").The semantics of the
@@ -10303,7 +10327,7 @@ typedef std::map<std::string, std::string> properties;index_options
specifier for a container type are similar to those of theindex_options
specifier for - a container data member (Section 12.4.21, + a container data member (Section 12.4.23, "index_options
").The semantics of the
@@ -10320,7 +10344,7 @@ typedef std::set<std::string> nicknames;key_options
specifier for a container type are similar to those of thekey_options
specifier for - a container data member (Section 12.4.22, + a container data member (Section 12.4.24, "key_options
").The semantics of the
@@ -10477,87 +10501,99 @@ typedef std::map<unsigned short, float> age_weight_map;value_options
specifier for a container type are similar to those of thevalue_options
specifier for - a container data member (Section 12.4.23, + a container data member (Section 12.4.25, "value_options
").+ + ++ index
define database index for a member +12.4.14 ++ + ++ unique
define unique database index for a member +12.4.15 +unordered
ordered container should be stored unordered -12.4.14 +12.4.16 table
table name for a container -12.4.15 +12.4.17 index_type
database type for a container's index type -12.4.16 +12.4.18 key_type
database type for a container's key type -12.4.17 +12.4.19 value_type
database type for a container's value type -12.4.18 +12.4.20 value_null
/value_not_null
container's value can/cannot be -NULL
12.4.19 +12.4.21 id_options
database options for a container's id column -12.4.20 +12.4.22 index_options
database options for a container's index column -12.4.21 +12.4.23 key_options
database options for a container's key column -12.4.22 +12.4.24 value_options
database options for a container's value column -12.4.23 +12.4.25 id_column
column name for a container's object id -12.4.24 +12.4.26 index_column
column name for a container's index -12.4.25 +12.4.27 key_column
column name for a container's key -12.4.26 +12.4.28 @@ -10856,8 +10892,8 @@ class person { ... - #pragma db options("UNIQUE") - std::string email_; // Mapped to TEXT NOT NULL UNIQUE. + #pragma db options("CHECK(email != '')") + std::string email_; // Mapped to TEXT NOT NULL CHECK(email != ''). }; value_column
column name for a container's value -12.4.27 +12.4.29
unordered
").
+ (Section 12.4.16, "unordered
").
For a more detailed discussion of inverse members, refer to Section 6.2, "Bidirectional Relationships".
@@ -11124,7 +11160,45 @@ class personFor a more detailed discussion of optimistic concurrency, refer to Chapter 11, "Optimistic Concurrency".
-unordered
index
The index
specifier instructs the ODB compiler to define
+ a database index for the data member. For example:
+#pragma db object +class person +{ + ... + + #pragma db index + std::string name_; +}; ++ +
For more information on defining database indexes, refer to + Section 12.6, "Index Definition Pragmas".
+ +unique
The index
specifier instructs the ODB compiler to define
+ a unique database index for the data member. For example:
+#pragma db object +class person +{ + ... + + #pragma db unique + std::string name_; +}; ++ +
For more information on defining database indexes, refer to + Section 12.6, "Index Definition Pragmas".
+ +unordered
The unordered
specifier specifies that a member of
an ordered container type should be stored unordered in the database.
@@ -11147,7 +11221,7 @@ class person
storage in the database, refer to Section 5.1,
"Ordered Containers".
table
table
The table
specifier specifies the table name that should
be used to store the contents of a container member. For example:
schema
".
- index_type
index_type
The index_type
specifier specifies the native
database type that should be used for an ordered container's
@@ -11215,7 +11289,7 @@ class person
};
-
key_type
key_type
The key_type
specifier specifies the native
database type that should be used for a map container's
@@ -11235,7 +11309,7 @@ class person
};
-
value_type
value_type
The value_type
specifier specifies the native
database type that should be used for a container's
@@ -11256,11 +11330,11 @@ class person
The value_null
and value_not_null
- (Section 12.4.19,
+ (Section 12.4.21,
"value_null
/value_not_null
") specifiers
can be used to control the NULL semantics of a value column.
value_null
/value_not_null
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
@@ -11293,7 +11367,7 @@ class account
Multiset Containers") the element value is automatically treated
as not allowing a NULL
value.
id_options
id_options
The id_options
specifier specifies additional
column definition options that should be used for a container's
@@ -11317,7 +11391,7 @@ class person
of the options
specifier (Section
12.4.7, "options
").
index_options
index_options
The index_options
specifier specifies additional
column definition options that should be used for a container's
@@ -11338,7 +11412,7 @@ class person
of the options
specifier (Section
12.4.7, "options
").
key_options
key_options
The key_options
specifier specifies additional
column definition options that should be used for a container's
@@ -11359,7 +11433,7 @@ class person
of the options
specifier (Section
12.4.7, "options
").
value_options
value_options
The value_options
specifier specifies additional
column definition options that should be used for a container's
@@ -11380,7 +11454,7 @@ class person
of the options
specifier (Section
12.4.7, "options
").
id_column
id_column
The id_column
specifier specifies the column
name that should be used to store the object id in a
@@ -11404,7 +11478,7 @@ class person
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
@@ -11428,7 +11502,7 @@ class person
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
@@ -11452,7 +11526,7 @@ class person
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
@@ -11692,7 +11766,207 @@ namespace hr
"session
"). For more information on sessions,
refer to Chapter 10, "Session".
While it is possible to manually add indexes to the generated
+ database schema, it is more convenient to do this as part of
+ the persistent class definitions. A pragma with the index
+ qualifier describes a database index. It has the following
+ general format:
+#pragma db index[("<name>")] \ + [unique|type("<type>")] \ + [method("<method>")] \ + [options("<index-options>")] \ + member(<name>[, "<column-options>"])... \ + members(<name>[,<name>...])... ++ +
The index
qualifier can optionally specify the
+ index name. If the index name is not specified, then one is
+ automatically derived by appending the _i
suffix
+ to the column name of the index member. If the name is not
+ specified and the index contains multiple members, then the
+ index definition is invalid.
The optional type
, method
, and
+ options
clauses specify the index type, for
+ example UNIQUE
, index method, for example
+ BTREE
, and index options, respectively. The
+ unique
clause is a shortcut for
+ type("UNIQUE")
. Note that not all database
+ systems support specifying an index method or options.
+ For more information on the database system-specific index
+ types, methods, and options, refer to Part II,
+ "Database Systems".
To specify index members we can use the member
+ or members
clauses, or a mix of the two. The
+ member
clause allows us to specify a single
+ index member with optional column options, for example,
+ "ASC"
. If we need to create a composite
+ index that contains multiple members, then we can repeat
+ the member
clause several times or, if the
+ members don't have any column options, we can use a single
+ members
clause instead. Similar to the index
+ type, method, and options, the format of column options is
+ database system-specific. For more details, refer to
+ Part II, "Database Systems".
The following code fragment shows some typical examples + of index definitions:
+ ++#pragma db object +class object +{ + ... + + int x; + int y; + int z1; + int z2; + + // An index for member x with automatically-assigned name x_i. + // + #pragma db index member(x) + + // A unique index named y_index for member y which is sorted in + // the descending order. The index is using the BTREE method. + // + #pragma db index("y_index") unique method("BTREE") member(y, "DESC") + + // A composite BITMAP index named z_i for members z1 and z2. + // + #pragma db index("z_i") type("BITMAP") members(z1, z2) +}; ++ +
ODB also offers a shortcut for defining an index with the default
+ method and options for a single data member. Such an index can
+ be defined using the index
(Section
+ 12.4.14, "index
") or unique
+ (Section 12.4.15, "unique
")
+ member specifier. For example:
+#pragma db object +class object +{ + ... + + #pragma db index + int x; + + #pragma db type("INT") unique + int y; +}; ++ +
The above example is semantically equivalent to the following + more verbose version:
+ ++#pragma db object +class object +{ + ... + + int x; + + #pragma db type("INT") + int y; + + #pragma db index member(x) + #pragma db index unique member(y) +}; ++ +
While it is convenient to define an index inside a persistent + class, it is also possible to do that out of the class body. In this + case, the index name, if specified, must be prefixed with the + potentially-qualified class name. For example:
+ ++namespace n +{ + #pragma db object + class object + { + ... + + int x; + int y; + }; + + // An index for member x in persistent class object with automatically- + // assigned name x_i. + // + #pragma db index(object) member(x) +} + +// An index named y_index for member y in persistent class n::object. +// +#pragma db index(n::object::"y_index") member(y) ++ +
It is possible to define an index on a member that is of a + composite value type or on some of its nested members. For + example:
+ ++#pragma db value +struct point +{ + int x; + int y; + int z; +}; + +#pragma db object +class object +{ + // An index that includes all of the p1's nested members. + // + #pragma db index + point p1; + + point p2; + + // An index that includes only p2.x and p2.y. + // + #pragma db index("p2_xy_i") members(p2.x, p2.y) +}; ++ +
When generating a schema for a container member (Chapter 5,
+ "Containers"), ODB automatically defines two indexes on the container
+ table. One is for the object id that references the object table and the
+ other is for the index column in case the container is ordered
+ (Section 5.1, "Ordered Containers"). By default these
+ indexes use the default index name, type, method, and options. The
+ index
pragma allows us to customize these two indexes by
+ recognizing the special id
and index
nested
+ member names when specified after a container member. For example:
+#pragma db object +class object +{ + std::vector<int> v; + + // Change the container id index name. + // + #pragma db index("id_index") member(v.id) + + // Change the container index index method. + // + #pragma db index method("BTREE") member(v.index) +}; ++ +
A pragma with the map
qualifier describes a
mapping between two database types. For each database system
@@ -11755,6 +12029,8 @@ namespace hr
#pragma db object
class object
{
+ ...
+
#pragma db type("INTEGER[]")
std::string array_;
};
@@ -11860,6 +12136,8 @@ namespace odb
#pragma db object
class object
{
+ ...
+
#pragma db type("INTEGER[]")
std::vector<int> array_;
};
@@ -11876,6 +12154,8 @@ typedef std::vector<int> int_vector;
#pragma db object
class object
{
+ ...
+
std::vector<int> array_; // Mapped to INTEGER[].
};
@@ -11887,7 +12167,7 @@ class object
for each database, shows how to provide custom mapping for some of
the additional types.
When a C++ header file defining persistent classes and containing ODB pragmas is used to build the application, the C++ compiler may @@ -11940,7 +12220,7 @@ class person
The disadvantage of this approach is that it can quickly become overly verbose when positioned pragmas are used.
-GNU g++ does not issue warnings about unknown pragmas
unless requested with the -Wall
command line option.
@@ -11952,7 +12232,7 @@ class person
g++ -Wall -Wno-unknown-pragmas ...
-
Microsoft Visual C++ issues an unknown pragma warning (C4068) at warning level 1 or higher. This means that unless we have disabled @@ -11986,7 +12266,7 @@ class person #pragma warning (pop) -
The Sun C++ compiler does not issue warnings about unknown pragmas
unless the +w
or +w2
option is specified.
@@ -11998,7 +12278,7 @@ class person
CC +w -erroff=unknownpragma ...
-
IBM XL C++ issues an unknown pragma warning (1540-1401) by default.
To disable this warning we can add the -qsuppress=1540-1401
@@ -12008,7 +12288,7 @@ CC +w -erroff=unknownpragma ...
xlC -qsuppress=1540-1401 ...
-
HP aC++ (aCC) issues an unknown pragma warning (2161) by default.
To disable this warning we can add the +W2161
@@ -12018,7 +12298,7 @@ xlC -qsuppress=1540-1401 ...
aCC +W2161 ...
-
Clang does not issue warnings about unknown pragmas
unless requested with the -Wall
command line option.
@@ -12277,7 +12557,7 @@ class object
It is also possible to add support for additional MySQL types, such as geospatial types. For more information, refer to - Section 12.6, "Database Type Mapping + Section 12.7, "Database Type Mapping Pragmas".
When the index
pragma (Section 12.6,
+ "Index Definition Pragmas") is used to define a MySQL index,
+ the type
clause specifies the index type (for example,
+ UNIQUE
, FULLTEXT
, SPATIAL
),
+ the method
clause specifies the index method (for
+ example, BTREE
, HASH
), and the
+ options
clause is not used. The column options
+ can be used to specify column length limits and the sort order.
+ For example:
+#pragma db object +class object +{ + ... + + std::string name_; + + #pragma db index method("HASH") member(name_, "(100) DESC") +}; ++ + @@ -12895,7 +13200,7 @@ class object
It is also possible to add support for additional SQLite types,
such as NUMERIC
. For more information, refer to
- Section 12.6, "Database Type Mapping
+ Section 12.7, "Database Type Mapping
Pragmas".
When the index
pragma (Section 12.6,
+ "Index Definition Pragmas") is used to define an SQLite index,
+ the type
clause specifies the index type (for example,
+ UNIQUE
) while the method
and
+ options
clauses are not used. The column options
+ can be used to specify collations and the sort order. For example:
+#pragma db object +class object +{ + ... + + std::string name_; + + #pragma db index member(name_, "COLLATE binary DESC") +}; ++ +
Index names in SQLite are database-global. To avoid name clashes, + ODB automatically prefixes each index name with the table name on + which it is defined.
@@ -13655,7 +13984,7 @@ class object such asNUMERIC
, geometry types, XML
,
JSON
, enumeration types, composite types, arrays,
geospatial types, and the key-value store (HSTORE
).
- For more information, refer to Section 12.6,
+ For more information, refer to Section 12.7,
"Database Type Mapping Pragmas".
ODB does not currently support the PostgreSQL date-time types - with timezone information.
+ODB does not currently natively support the PostgreSQL date-time types + with timezone information. However, these types can be accessed by + mapping them to one of the natively supported types, as discussed + in Section 12.7, "Database Type Mapping Pragmas".
NUMERIC
Type SupportNUMERIC
values refer to the PostgreSQL
- documentation.
+ documentation. An alternative approach to accessing NUMERIC
+ values is to map this type to one of the natively supported
+ ones, as discussed in Section 12.7, "Database
+ Type Mapping Pragmas".
+
+
+ When the index
pragma (Section 12.6,
+ "Index Definition Pragmas") is used to define a PostgreSQL index,
+ the type
clause specifies the index type (for example,
+ UNIQUE
), the method
clause specifies the
+ index method (for example, BTREE
, HASH
,
+ GIN
, etc.), and the options
clause
+ specifies additional index options, such as storage parameters,
+ table spaces, and the WHERE
predicate. To support
+ the definition of concurrent indexes, the type
+ clause can end with the word CONCURRENTLY
(upper and
+ lower cases are recognized). The column options can be used to
+ specify collations, operator classes, and the sort order. For example:
+#pragma db object +class object +{ + ... + + std::string name_; + + #pragma db index \ + type("UNIQUE CONCURRENTLY") \ + method("HASH") \ + member(name_, "DESC") \ + options("WITH(FILLFACTOR = 80)") +}; ++ +
Index names in PostgreSQL are schema-global. To avoid name clashes, + ODB automatically prefixes each index name with the table name on + which it is defined.
@@ -14291,7 +14660,7 @@ class objectIt is also possible to add support for additional Oracle types,
such as XML
, geospatial types, user-defined types,
and collections (arrays, table types). For more information, refer to
- Section 12.6, "Database Type Mapping
+ Section 12.7, "Database Type Mapping
Pragmas".
FLOAT
and NUMBER
values,
refer to the Oracle Call Interface (OCI) documentation.
+ An alternative approach to accessing large FLOAT
and
+ NUMBER
values is to map these type to one of the
+ natively supported ones, as discussed in Section
+ 12.7, "Database Type Mapping Pragmas".
Note that a NUMBER
type that is used to represent a
floating point number (declared by specifying NUMBER
without any range and scale) can be extracted into the C++
@@ -14872,12 +15246,45 @@ CREATE TABLE Employee (
ODB does not currently support the Oracle date-time types with timezone - information.
+ information. However, these types can be accessed by mapping them to + one of the natively supported types, as discussed in + Section 12.7, "Database Type Mapping Pragmas".LONG
TypesODB does not support the deprecated Oracle LONG
and
- LONG RAW
data types.
LONG RAW
data types. However, these types can be accessed
+ by mapping them to one of the natively supported types, as discussed
+ in Section 12.7, "Database Type Mapping Pragmas".
+
+ When the index
pragma (Section 12.6,
+ "Index Definition Pragmas") is used to define an Oracle index,
+ the type
clause specifies the index type (for example,
+ UNIQUE
, BITMAP
), the method
+ clause is not used, and the options
clause specifies
+ additional index properties, such as partitioning, table spaces, etc.
+ The column options can be used to specify the sort order. For example:
+#pragma db object +class object +{ + ... + + std::string name_; + + #pragma db index \ + type("BITMAP") \ + member(name_, "DESC") \ + options("TABLESPACE TBS1") +}; ++ +
Index names in Oracle are schema-global. To avoid name clashes, + ODB automatically prefixes each index name with the table name on + which it is defined.
@@ -15151,7 +15558,7 @@ t.commit ();It is also possible to add support for additional SQL Server types,
such as geospatial types, XML
, and user-defined types.
- For more information, refer to Section 12.6, "Database
+ For more information, refer to Section 12.7, "Database
Type Mapping Pragmas".
--mssql-server-version 9.0
ODB
compiler option.
+ When the index
pragma (Section 12.6,
+ "Index Definition Pragmas") is used to define an SQL Server index,
+ the type
clause specifies the index type (for example,
+ UNIQUE
, CLUSTERED
), the method
+ clause is not used, and the options
clause specifies
+ additional index properties. The column options can be used to specify
+ the sort order. For example:
+#pragma db object +class object +{ + ... + + std::string name_; + + #pragma db index \ + type("UNIQUE CLUSTERED") \ + member(name_, "DESC") \ + options("WITH(FILLFACTOR = 80)") +}; ++ -- cgit v1.1