|
ITTIA DB SQL C API
5.4.0
|
A table is composed of fields.
| #define DB_NULLABLE _DB_NULLABLE |
Field can be NULL.
| #define DB_TABLETYPE_DEFAULT _DB_TABLETYPE_DEFAULT |
Default table type.
| #define DB_NOT_NULL _DB_NOT_NULL |
Field cannot be NULL.
| #define DB_TABLETYPE_KHEAP _DB_TABLETYPE_KHEAP |
Key heap table type, stored on disk.
| #define DB_TABLETYPE_MEMORY _DB_TABLETYPE_MEMORY |
Memory table, stored on in-memory storage.
| #define DB_TABLETYPE_CLUSTERED _DB_TABLETYPE_CLUSTERED |
Clustered table, stored on disk and grouped by a clustering index.
| db_result_t db_fielddef_init | ( | db_fielddef_t * | fdef | ) |
Initialize a field schema definition.
| fdef | Address of a field configuration. |
On failure, one of the following error codes is set:
| db_result_t db_fielddef_destroy | ( | db_fielddef_t * | fdef | ) |
Destroy a field schema definition.
| fdef | Field configuration. |
| db_result_t db_tabledef_init | ( | db_tabledef_t * | tdef, |
| db_heap_t | heap | ||
| ) |
Initialize a table definition.
| tdef | Table configuration. |
| heap | Pointer to heap. |
| db_result_t db_tabledef_destroy | ( | db_tabledef_t * | tdef | ) |
Destroy a table definition.
Unlock a database object.
| tdef | Table configuration. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_tabletype | ( | db_tabledef_t * | tdef, |
| db_tabletype_t | type | ||
| ) |
Set the table type for a table definition.
| tdef | Table configuration. |
| type | Table type. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_field_count | ( | db_tabledef_t * | tdef, |
| db_fieldno_t | nfields | ||
| ) |
Set the number of fields in a table definition.
| tdef | Table configuration. |
| nfields | Number of fields. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_field | ( | db_tabledef_t * | tdef, |
| db_fieldno_t | nfield, | ||
| const db_fielddef_t * | field | ||
| ) |
Set a field in a table definition.
| tdef | Table configuration. |
| nfield | Number of field. |
| field | Field configuration. |
On failure, one of the following error codes is set:
| db_result_t db_tabledef_set_fields | ( | db_tabledef_t * | tdef, |
| const db_fielddef_t * | fields, | ||
| db_fieldno_t | nfields | ||
| ) |
Set all of the fields for a table definition.
| tdef | Table configuration. |
| fields | Field configuration(s). |
| nfields | Number of fields. |
On failure, one of the following error codes is set:
| db_result_t db_create_table | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_tabledef_t * | param, | ||
| db_flags_t | flags | ||
| ) |
Create a table in a database using a table 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. |
| param | Table definition parameters. Field names must start with a letter and can be followed by one or more letters, numbers, or underscores. |
| flags | Reserved for future use. Set to zero. |
On failure, one of the following error codes is set:
If param->table_type is DB_TABLETYPE_CLUSTERED, a clustering index must be supplied in param->indexes. The index_mode for that index must be set to DB_CLUSTERING_INDEX | DB_PRIMARY_INDEX and all index fields must have the flag DB_NOT_NULL.
| db_result_t db_drop_table | ( | db_t | hdb, |
| const db_objname_t * | name | ||
| ) |
Drop a table from a database.
| hdb | Database handle. |
| name | Table name. A name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
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_table | ( | db_t | hdb, |
| const db_objname_t * | name, | ||
| db_tabledef_t * | param, | ||
| db_flags_t | flags | ||
| ) |
Obtain the schema definition for a table in a database.
| hdb | Database handle. |
| name | Table name. A name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
| param | Table configuration. |
| flags |
|
On failure, one of the following error codes is set:
| db_result_t db_add_field | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_fielddef_t * | field_def | ||
| ) |
Add a field to an existing table.
| hdb | Database handle. |
| table | Table name. |
| field_def | Field configuration. A field name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
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_drop_field | ( | db_t | hdb, |
| const db_objname_t * | table, | ||
| const db_objname_t * | field | ||
| ) |
Drop a field from a table.
| hdb | Database handle. |
| table | Table name. |
| field | Field name. A name must start with a letter and can be followed by one or more letters, numbers, or underscores. |
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.