DuroDBMS API  1.2
Functions
Index functions

Functions

int RDB_create_table_index (const char *name, RDB_object *tbp, int idxcompc, const RDB_seq_item idxcompv[], int flags, RDB_exec_context *ecp, RDB_transaction *txp)
 
int RDB_drop_table_index (const char *name, RDB_exec_context *ecp, RDB_transaction *txp)
 
RDB_bool RDB_expr_is_serial (const RDB_expression *exp)
 

Detailed Description

#include <rel/rdb.h>

Function Documentation

int RDB_create_table_index ( const char *  name,
RDB_object *  tbp,
int  idxcompc,
const RDB_seq_item  idxcompv[],
int  flags,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_create_table_index creates an index with name name for the table specified by tbp over the attributes specified by idxcompc and idxcompv. The flags argument must be either 0 or RDB_ORDERED. If flags is 0, a hash index is created. If flags is RDB_ORDERED, a B-tree index is created.

Functions which read tuples from a table (like RDB_table_to_array and RDB_extract_tuple) try to use available indexes to achieve better performance.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
invalid_argument_error
name is not a valid index name.
element_exist_error
An index with name name already exists.
name_error
An attribute specified by idxcompv does not appear in the table.

The call may also fail for a system error, in which case the transaction may be implicitly rolled back.

References RDB_seq_item::asc, RDB_alloc(), RDB_db_env(), RDB_free(), RDB_raise_invalid_argument(), RDB_raise_no_memory(), RDB_realloc(), RDB_table_is_persistent(), RDB_table_name(), and RDB_tx_db().

int RDB_drop_table_index ( const char *  name,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_drop_table_index drops the index specified by name.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
not_found_error
An index with name name does not exist.

The call may also fail for a system error, in which case the transaction may be implicitly rolled back.

References RDB_db_env(), RDB_destroy_obj(), RDB_free(), RDB_get_table(), RDB_init_obj(), RDB_obj_property(), RDB_obj_string(), RDB_raise_internal(), RDB_raise_not_found(), RDB_realloc(), and RDB_tx_db().