Collaboration diagram for Update Functions:

Functions

RDM_RETCODE rdm_dbAlterCatalog (RDM_DB db, const char *ddlStmt)
 Process a schema DDL command. More...
 

Detailed Description

Schema API for altering the schema. All the functions here are located in RDM DB Engine Library. Linker option:

    -lrdmrdm

Function Documentation

◆ rdm_dbAlterCatalog()

RDM_RETCODE rdm_dbAlterCatalog ( RDM_DB  db,
const char *  ddlStmt 
)

#include <rdmdbapi.h>

Process a schema DDL command.

This function processes a schema DDL (data definition language) command

The DDL commands allow for modifying the format and structure of a database. This function can be used to create a new database or to alter the structure of an existing database. The use of this function requires exclusive access to the schema. This can be gained by issuing a call to rdm_dbStartUpdate() with the schema (RDM_LOCK_SCHEMA) as one of the tables to write lock.

The changes made to the schema will be visible locally immediately, but will not be made available to other sessions until the transaction has been committed. If the transaction is aborted then the database structure will be unchanged.

Locking Requirements
Write lock on the schema (RDM_LOCK_SCHEMA)
Return values
sOKAYNormal, successful return.
eNOSTARTUPDATEAn update operation was attempted when no rdm_dbStartUpdate() is active.
eNOTLOCKEDAttempt to access a table for reading or update without proper locks.
eDDL_ALTERACTInvalid ALTER action spec.
eDDL_CONSTRNOTFOUNDConstraint not found.
eDDL_DROPNOTNULLCannot DROP NOT NULL: column is not defined as NOT NULL.
eDDL_DUPTABNAMEDuplicate table name.
eDDL_NULLCONFLICTNOT NULL constraint specified for a column that has NULL values or a NULL default value.
eSYNTAXSyntax error.
eINVFORUNIONInvalid operation on unioned db.
ePRECOMMITTEDA precommitted transaction must be committed or rolled back before further operations on this database are allowed.
eREADONLYDatabase is read-only and cannot be updated.
See also
rdm_dbStartUpdate
rdm_dbSetCatalog
rdm_dbEnd
DDL User Guide
Parameters
[in]dbA valid RDM database handle
[in]ddlStmtThe ddl statement to execute