|
ITTIA DB SQL C API
5.4.0
|
An index is used to optimize seek, sort, and filter operations.
| #define DB_MULTISET_INDEX _DB_MULTISET_INDEX |
Multiset (non-unique) index.
| #define DB_INDEXTYPE_DEFAULT _DB_INDEXTYPE_DEFAULT |
Default index type.
| #define DB_UNIQUE_INDEX _DB_UNIQUE_INDEX |
Unique index.
| #define DB_PRIMARY_INDEX _DB_PRIMARY_INDEX |
Primary key index.
| #define DB_NUMBERED_INDEX _DB_NUMBERED_INDEX |
Numbered index.
| #define DB_CLUSTERING_INDEX _DB_CLUSTERING_INDEX |
The index used to cluster a table.
| db_result_t db_indexfield_init | ( | db_indexfield_t * | idef | ) |
Initialize index field definition.
| idef | Index field definition. |
On failure, one of the following error codes is set:
| db_result_t db_indexfield_destroy | ( | db_indexfield_t * | idef | ) |
Destroy index field definition.
| idef | Index field definition. |
On failure, one of the following error codes is set:
| db_result_t db_indexdef_init | ( | db_indexdef_t * | idef, |
| db_heap_t | heap | ||
| ) |
Initialize an index schema definition.
| idef | Index configuration. |
| heap | Pointer to heap. |
On failure, one of the following error codes is set:
| db_result_t db_indexdef_destroy | ( | db_indexdef_t * | idef | ) |
Destroy an index schema definition.
| idef | Index configuration. |
On failure, one of the following error codes is set:
| db_result_t db_indexdef_set_indextype | ( | db_indexdef_t * | idef, |
| db_indextype_t | itype | ||
| ) |
Set the index type for an index definition.
| idef | Index configuration. |
| itype | Index type. |
| db_result_t db_indexdef_set_field_count | ( | db_indexdef_t * | idef, |
| db_fieldno_t | nfields | ||
| ) |
Set the number of fields in an index definition.
| idef | Index configuration. |
| nfields | Number of fields. |
| db_result_t db_indexdef_set_field | ( | db_indexdef_t * | idef, |
| db_fieldno_t | nfield, | ||
| const db_indexfield_t * | ifield | ||
| ) |
Set a field in an index definition.
| idef | Index configuration. |
| nfield | Field number. |
| ifield | Index definition field. |
| db_result_t db_tabledef_set_index_count | ( | db_tabledef_t * | tdef, |
| db_len_t | nindexes | ||
| ) |
Set the number of indexes in a table definition.
| tdef | Table configuration. |
| nindexes | Number of indexes. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_indexes | ( | db_tabledef_t * | tdef, |
| const db_indexdef_t * | indexes, | ||
| db_len_t | nindexes | ||
| ) |
Set all of the indexes for a table definition.
| tdef | Table configuration. |
| indexes | Index configuration(s). |
| nindexes | Number of indexes. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_index | ( | db_tabledef_t * | tdef, |
| db_len_t | nindex, | ||
| const db_indexdef_t * | idef | ||
| ) |
Set an index in a table definition.
| tdef | Table configuration. |
| nindex | Number of index to set. |
| idef | Index configuration. |
On failure, one of the following error codes is set:
| db_result_t db_create_index | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_objname_t * | index, | ||
| const db_indexdef_t * | param | ||
| ) |
Create an index on a table using an index schema definition.
| hdb | Database handle. |
| table | Table name. A name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
| index | Index name. A name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
| param | Index configuration. |
On failure, one of the following error codes is set:
A table can only be altered or dropped when there is no active transaction. If a transaction has been started, db_commit_tx or db_abort_tx must be used before db_drop_table can be called.
If index->index_mode is DB_PRIMARY_INDEX, all index fields must have been created with the flag DB_NOT_NULL. Only one index can be created with the DB_PRIMARY_INDEX flag.
| db_result_t db_drop_index | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_objname_t * | index | ||
| ) |
Removes an index from a table.
| hdb | Database handle. |
| table | Table name. |
| index | Index name. |
On failure, one of the following error codes is set:
A table can only be altered or dropped when there is no active transaction. If a transaction has been started, db_commit_tx or db_abort_tx must be used before db_drop_table can be called.
| db_result_t db_describe_index | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_objname_t * | index, | ||
| db_indexdef_t * | params | ||
| ) |
Retrieves the schema definition for an index on a table.
| hdb | Database handle. |
| table | Table name. |
| index | Index name. |
| params | Returned index configuration. |
On failure, one of the following error codes is set: