DuroDBMS API  1.2
Functions
Database functions

Functions

const char * RDB_db_name (const RDB_database *dbp)
 
RDB_environment * RDB_db_env (RDB_database *dbp)
 
RDB_database * RDB_create_db_from_env (const char *name, RDB_environment *envp, RDB_exec_context *ecp)
 
RDB_database * RDB_get_db_from_env (const char *name, RDB_environment *envp, RDB_exec_context *ecp)
 
int RDB_drop_db (RDB_database *dbp, RDB_exec_context *ecp)
 
int RDB_get_dbs (RDB_environment *envp, RDB_object *arrp, RDB_exec_context *ecp)
 

Detailed Description

#include <rel/rdb.h>

Function Documentation

RDB_database* RDB_create_db_from_env ( const char *  name,
RDB_environment *  envp,
RDB_exec_context *  ecp 
)

RDB_create_db_from_env creates a database from a database environment. If an error occurs, an error value is left in *ecp.

Returns

A pointer to the newly created database, or NULL if an error occurred.

Errors:
element_exists_error
A database with the name name already exixts.
version_mismatch_error
The version number stored in the catalog does not match the version of the library.

The call may also fail for a system error.

References RDB_raise_invalid_argument().

RDB_environment* RDB_db_env ( RDB_database *  dbp)

RDB_db_env returns a pointer to the database environment of the database specified by dbp.

Returns

A pointer to the database environment.

Referenced by RDB_create_table_index(), RDB_drop_table_index(), RDB_get_table(), and RDB_set_table_name().

const char* RDB_db_name ( const RDB_database *  dbp)

Return a pointer to the name of the database specified by dbp.

Returns

The name of the database.

int RDB_drop_db ( RDB_database *  dbp,
RDB_exec_context *  ecp 
)

RDB_drop_db deletes the database specified by dbp. The database must be empty.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
not_found_error
The database was not found.
element_exists_error
The database is not empty.

The call may also fail for a system error.

References RDB_begin_tx(), RDB_commit(), RDB_delete(), RDB_drop_table(), RDB_eq(), RDB_raise_element_exists(), RDB_raise_not_found(), RDB_rollback(), RDB_string_to_expr(), RDB_table_is_empty(), and RDB_var_ref().

RDB_database* RDB_get_db_from_env ( const char *  name,
RDB_environment *  envp,
RDB_exec_context *  ecp 
)

RDB_get_db_from_env obtains a pointer to the database with name name in the environment specified by envp. If an error occurs, an error value is left in *ecp.

Returns

On success, a pointer to the database is returned. If an error occurred, NULL is returned.

Errors:
not_found_error
A database with the name name could not be found.
version_mismatch_error
The version number stored in the catalog does not match the version of the library.

The call may also fail for a system error.

int RDB_get_dbs ( RDB_environment *  envp,
RDB_object *  arrp,
RDB_exec_context *  ecp 
)

After RDB_get_dbs has been called successfully, *arrp is an array of strings which contains the names of all databases in *envp.

arrp must either already be an array of RDB_STRING or having been initialized using RDB_init_obj().

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
type_mismatch_error
*arrp already contains elements of a type different from RDB_STRING.

The call may fail for a system error.

References RDB_array_get(), RDB_array_length(), RDB_array_set(), RDB_commit(), RDB_destroy_obj(), RDB_drop_table(), RDB_init_obj(), RDB_raise_no_memory(), RDB_rollback(), RDB_set_array_length(), RDB_table_to_array(), and RDB_tuple_get().