Functions | |
| HAILDB_API ib_err_t | ib_table_schema_add_col (ib_tbl_sch_t ib_tbl_sch, const char *name, ib_col_type_t ib_col_type, ib_col_attr_t ib_col_attr, ib_u16_t client_type, ib_ulint_t len) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_table_schema_add_index (ib_tbl_sch_t ib_tbl_sch, const char *name, ib_idx_sch_t *ib_idx_sch) UNIV_NO_IGNORE |
| HAILDB_API void | ib_table_schema_delete (ib_tbl_sch_t ib_tbl_sch) |
| HAILDB_API ib_err_t | ib_table_schema_create (const char *name, ib_tbl_sch_t *ib_tbl_sch, ib_tbl_fmt_t ib_tbl_fmt, ib_ulint_t page_size) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_schema_add_col (ib_idx_sch_t ib_idx_sch, const char *name, ib_ulint_t prefix_len) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_schema_create (ib_trx_t ib_usr_trx, const char *name, const char *table_name, ib_idx_sch_t *ib_idx_sch) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_schema_set_clustered (ib_idx_sch_t ib_idx_sch) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_schema_set_unique (ib_idx_sch_t ib_idx_sch) UNIV_NO_IGNORE |
| HAILDB_API void | ib_index_schema_delete (ib_idx_sch_t ib_idx_sch) |
| HAILDB_API ib_err_t | ib_table_create (ib_trx_t ib_trx, const ib_tbl_sch_t ib_tbl_sch, ib_id_t *id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_table_rename (ib_trx_t ib_trx, const char *old_name, const char *new_name) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_create (ib_idx_sch_t ib_idx_sch, ib_id_t *index_id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_table_drop (ib_trx_t trx, const char *name) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_drop (ib_trx_t trx, ib_id_t index_id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_cursor_truncate (ib_crsr_t *ib_crsr, ib_id_t *table_id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_table_truncate (const char *table_name, ib_id_t *table_id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_table_get_id (const char *table_name, ib_id_t *table_id) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_index_get_id (const char *table_name, const char *index_name, ib_id_t *index_id) UNIV_NO_IGNORE |
| HAILDB_API ib_bool_t | ib_database_create (const char *dbname) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_database_drop (const char *dbname) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_schema_lock_shared (ib_trx_t ib_trx) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_schema_lock_exclusive (ib_trx_t ib_trx) UNIV_NO_IGNORE |
| HAILDB_API ib_bool_t | ib_schema_lock_is_exclusive (const ib_trx_t ib_trx) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_schema_unlock (ib_trx_t ib_trx) |
| HAILDB_API ib_err_t | ib_table_schema_visit (ib_trx_t ib_trx, const char *name, const ib_schema_visitor_t *visitor, void *arg) UNIV_NO_IGNORE |
| HAILDB_API ib_err_t | ib_schema_tables_iterate (ib_trx_t ib_trx, ib_schema_visitor_table_all_t visitor, void *arg) UNIV_NO_IGNORE |
Truncate a table. The cursor handle will be closed and set to NULL on success.
| [out] | ib_crsr | is the cursor for table to truncate |
| [out] | table_id | is the new table id |
| HAILDB_API ib_bool_t ib_database_create | ( | const char * | dbname | ) |
Create a database if it doesn't exist.
| dbname | is the name of the database to create |
| HAILDB_API ib_err_t ib_database_drop | ( | const char * | dbname | ) |
Drop a database if it exists. This function will also drop all tables within the database.
| dbname | is the name of the database to drop |
| HAILDB_API ib_err_t ib_index_create | ( | ib_idx_sch_t | ib_idx_sch, | |
| ib_id_t * | index_id | |||
| ) |
Create a secondary index. The index id encodes the table id in the high 4 bytes and the index id in the lower 4 bytes.
| [in,out] | ib_idx_sch | the schema for the index |
| [out] | index_id | is the new index id that was created |
Drop a secondary index. Ensure that you have acquired the schema lock in exclusive mode.
| trx | is the covering transaction. | |
| index_id | is the id of the index to drop |
| HAILDB_API ib_err_t ib_index_get_id | ( | const char * | table_name, | |
| const char * | index_name, | |||
| ib_id_t * | index_id | |||
| ) |
Get an index id.
| table_name | is the name of the table that contains the index | |
| index_name | is the name of the index to lookup | |
| [out] | index_id | contains the index id if found |
| HAILDB_API ib_err_t ib_index_schema_add_col | ( | ib_idx_sch_t | ib_idx_sch, | |
| const char * | name, | |||
| ib_ulint_t | prefix_len | |||
| ) |
Add columns to an index schema definition.
| [in,out] | ib_idx_sch | is the index schema instance |
| name | is the name of the column to add to the index schema | |
| prefix_len | is the prefix length of the index or 0 if no prefix |
| HAILDB_API ib_err_t ib_index_schema_create | ( | ib_trx_t | ib_usr_trx, | |
| const char * | name, | |||
| const char * | table_name, | |||
| ib_idx_sch_t * | ib_idx_sch | |||
| ) |
Create an index schema instance.
| ib_usr_trx | is the current user transaction | |
| name | is the name of the index to create | |
| table_name | is the name of the table the index belongs to | |
| [out] | ib_idx_sch | is the newly created index schema instance |
| HAILDB_API void ib_index_schema_delete | ( | ib_idx_sch_t | ib_idx_sch | ) |
Destroy an index schema.
| ib_idx_sch | is the index schema to delete |
| HAILDB_API ib_err_t ib_index_schema_set_clustered | ( | ib_idx_sch_t | ib_idx_sch | ) |
Set index as clustered index. Implies UNIQUE.
| [in,out] | ib_idx_sch | is the index schema to update |
| HAILDB_API ib_err_t ib_index_schema_set_unique | ( | ib_idx_sch_t | ib_idx_sch | ) |
Set index as a unique index.
| [in,out] | ib_idx_sch | is the index schema to update |
Latches the data dictionary in exclusive mode.
| ib_trx | is the transaction instance |
Checks if the data dictionary is latched in exclusive mode by a user transaction.
| ib_trx | is a transaction instance |
Latches the data dictionary in shared mode.
| ib_trx | is the transaction instance |
| HAILDB_API ib_err_t ib_schema_tables_iterate | ( | ib_trx_t | ib_trx, | |
| ib_schema_visitor_table_all_t | visitor, | |||
| void * | arg | |||
| ) |
List all the tables in the InnoDB's data dictionary. It will abort if visitor returns a non-zero value.
It will call the function: visitor.tables(arg, const char* name, int name_len);
The function will abort if visitor.tables() returns non-zero.
| ib_trx | is the transaction that owns the schema lock | |
| visitor | is the visitor function | |
| arg | argument passed to the visitor function |
Unlocks the data dictionary.
| ib_trx | is a transaction instance |
| HAILDB_API ib_err_t ib_table_create | ( | ib_trx_t | ib_trx, | |
| const ib_tbl_sch_t | ib_tbl_sch, | |||
| ib_id_t * | id | |||
| ) |
Create a table in the InnoDB data dictionary using the schema definition. If the table exists in the database then this function will return DB_TABLE_IS_BEING_USED and id will contain that table's id.
| [in,out] | ib_trx | the current user transaction |
| ib_tbl_sch | the the schema for the table to create | |
| [out] | id | table id that was created |
Drop a table. Ensure that you have acquired the schema lock in exclusive mode.
| trx | is the covering transaction. | |
| name | is the name of the table to drop |
Get a table id.
| table_name | is the name of the table to lookup | |
| [out] | table_id | is the new table id if found |
| HAILDB_API ib_err_t ib_table_rename | ( | ib_trx_t | ib_trx, | |
| const char * | old_name, | |||
| const char * | new_name | |||
| ) |
Rename a table. Ensure that you have acquired the schema lock in exclusive mode.
| [in,out] | ib_trx | is the current user transaction |
| old_name | the current name of the table | |
| new_name | the new name for the table |
| HAILDB_API ib_err_t ib_table_schema_add_col | ( | ib_tbl_sch_t | ib_tbl_sch, | |
| const char * | name, | |||
| ib_col_type_t | ib_col_type, | |||
| ib_col_attr_t | ib_col_attr, | |||
| ib_u16_t | client_type, | |||
| ib_ulint_t | len | |||
| ) |
Add columns to a table schema. Tables are created in InnoDB by first creating a table schema which is identified by a handle. Then you add the column definitions to the table schema.
| ib_tbl_sch | is the table schema instance | |
| name | is the name of the column to add | |
| ib_col_type | is the type of the column | |
| ib_col_attr | are the attributes of the column, including constraints | |
| client_type | is any 16 bit number relevant only to the client | |
| len | is the maximum length of the column |
| HAILDB_API ib_err_t ib_table_schema_add_index | ( | ib_tbl_sch_t | ib_tbl_sch, | |
| const char * | name, | |||
| ib_idx_sch_t * | ib_idx_sch | |||
| ) |
Create and add an index key definition to a table schema. The index schema is owned by the table schema instance and will be freed when the table schema instance is freed.
| [in,out] | ib_tbl_sch | is the schema instance |
| name | name of the key definition to create | |
| [out] | ib_idx_sch | is the key definition schema instance |
| HAILDB_API ib_err_t ib_table_schema_create | ( | const char * | name, | |
| ib_tbl_sch_t * | ib_tbl_sch, | |||
| ib_tbl_fmt_t | ib_tbl_fmt, | |||
| ib_ulint_t | page_size | |||
| ) |
Create a table schema.
| name | is the table name for which to create the schema | |
| [out] | ib_tbl_sch | is the schema instance that is created |
| ib_tbl_fmt | is the format of the table to be created | |
| page_size | is the page size for the table or 0 for default |
| HAILDB_API void ib_table_schema_delete | ( | ib_tbl_sch_t | ib_tbl_sch | ) |
Destroy a schema. The handle is freed by this function.
| ib_tbl_sch | is the table schema to delte |
| HAILDB_API ib_err_t ib_table_schema_visit | ( | ib_trx_t | ib_trx, | |
| const char * | name, | |||
| const ib_schema_visitor_t * | visitor, | |||
| void * | arg | |||
| ) |
Read a table's schema using the visitor pattern. It will make the following sequence of calls:
visitor->table() visitor->table_col() for each user column visitor->index() for each user index visitor->index_col() for each column in user index
It will stop if any of the above functions returns a non-zero value. The caller must have an exclusive lock on the InnoDB data dictionary
| ib_trx | transaction that owns the schema lock | |
| name | is the table name to read | |
| visitor | visitor functions to invoke on each definition | |
| arg | is the argument passed to the visitor functions. |
1.7.1