DuroDBMS API  1.7
Functions
Constraint functions

Functions

int RDB_apply_constraints (int insc, const RDB_ma_insert insv[], int updc, const RDB_ma_update updv[], int delc, const RDB_ma_delete delv[], int vdelc, const RDB_ma_vdelete vdelv[], int copyc, const RDB_ma_copy copyv[], RDB_apply_constraint_fn *applyfnp, RDB_getobjfn *getfn, void *getarg, RDB_exec_context *ecp, RDB_transaction *txp)
 
int RDB_create_constraint (const char *name, RDB_expression *exp, RDB_exec_context *ecp, RDB_transaction *txp)
 
int RDB_drop_constraint (const char *name, RDB_exec_context *ecp, RDB_transaction *txp)
 

Detailed Description

Function Documentation

◆ RDB_apply_constraints()

int RDB_apply_constraints ( int  insc,
const RDB_ma_insert  insv[],
int  updc,
const RDB_ma_update  updv[],
int  delc,
const RDB_ma_delete  delv[],
int  vdelc,
const RDB_ma_vdelete  vdelv[],
int  copyc,
const RDB_ma_copy  copyv[],
RDB_apply_constraint_fn *  applyfnp,
RDB_getobjfn *  getfn,
void *  getarg,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

Get expressions that would have been evaluated by an invocation of RDB_multi_assign() and invoke *applyfn with the optimized expression as argument. Stop if the invocation returns a value different from RDB_OK.

References RDB_free().

◆ RDB_create_constraint()

int RDB_create_constraint ( const char *  name,
RDB_expression *  exp,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_create_constraint creates a constraint with the name name on the database the transaction specified by txp interacts with.

Returns
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
no_running_tx_error
txp does not point to a running transaction.
type_mismatch_error
The *constrp is not of type BOOLEAN.
predicate_violation_error
The *constrp does not evaluate to TRUE.

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

References RDB_dup_expr().

◆ RDB_drop_constraint()

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

RDB_drop_constraint deletes the constraint with the name name.

Returns
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
no_running_tx_error
txp does not point to a running transaction.
not_found_error
A constraint with the name name could not be found.

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

References RDB_del_expr(), RDB_delete(), RDB_eq(), RDB_free(), RDB_string_to_expr(), RDB_tx_db(), and RDB_var_ref().