DuroDBMS API  1.7
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, RDB_transaction *txp)
 
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_create_db_from_env()

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.

◆ RDB_db_env()

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.

◆ RDB_db_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.

◆ RDB_drop_db()

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_get_db_from_env()

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

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. txp may be NULL.

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.

◆ RDB_get_dbs()

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.