DuroDBMS API
1.7
|
Data Structures | |
struct | RDB_parameter |
Typedefs | |
typedef void | RDB_op_cleanup_func(RDB_operator *) |
typedef struct RDB_parameter | RDB_parameter |
Functions | |
RDB_parameter * | RDB_get_parameter (const RDB_operator *op, int idx) |
const char * | RDB_operator_name (const RDB_operator *op) |
RDB_type * | RDB_operator_type (const RDB_operator *op) |
int | RDB_operator_param_count (const RDB_operator *op) |
RDB_type * | RDB_return_type (const RDB_operator *op) |
void * | RDB_operator_u_data (const RDB_operator *op) |
void | RDB_set_operator_u_data (RDB_operator *op, void *u_data) |
const char * | RDB_operator_source (const RDB_operator *op) |
RDB_object * | RDB_operator_creation_time (RDB_operator *op) |
void | RDB_set_op_cleanup_fn (RDB_operator *op, RDB_op_cleanup_func *fp) |
int | RDB_create_ro_op (const char *name, int paramc, RDB_parameter paramv[], RDB_type *rtyp, const char *libname, const char *symname, const char *sourcep, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_create_ro_op_version (const char *name, const char *version, int paramc, RDB_parameter paramv[], RDB_type *rtyp, const char *libname, const char *symname, const char *sourcep, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_create_update_op (const char *name, int paramc, RDB_parameter paramv[], const char *libname, const char *symname, const char *sourcep, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_create_update_op_version (const char *name, const char *version, int paramc, RDB_parameter paramv[], const char *libname, const char *symname, const char *sourcep, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_call_ro_op_by_name (const char *name, int argc, RDB_object *argv[], RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *retvalp) |
int | RDB_call_ro_op_by_name_e (const char *name, int argc, RDB_object *argv[], RDB_environment *envp, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *retvalp) |
RDB_operator * | RDB_get_update_op (const char *name, int argc, RDB_type *argtv[], RDB_environment *envp, RDB_exec_context *ecp, RDB_transaction *txp) |
RDB_operator * | RDB_get_update_op_by_args (const char *name, int argc, RDB_object *argv[], RDB_environment *envp, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_call_update_op_by_name (const char *name, int argc, RDB_object *argv[], RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_call_update_op (RDB_operator *op, int argc, RDB_object *argv[], RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_drop_op (const char *opname, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_drop_op_version (const char *opname, const char *version, RDB_exec_context *ecp, RDB_transaction *txp) |
typedef void RDB_op_cleanup_func(RDB_operator *) |
A function which is called when an operator is deleted from memory.
typedef struct RDB_parameter RDB_parameter |
Represents a parameter of an operator.
int RDB_call_ro_op_by_name | ( | const char * | name, |
int | argc, | ||
RDB_object * | argv[], | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp, | ||
RDB_object * | retvalp | ||
) |
RDB_call_ro_op_by_name invokes the read-only operator with the name name, passing the arguments in argc and argv.
The result will be stored at the location pointed to by retvalp.
The arguments must carry type information.
If txp is NULL, only built-in operators can be found.
If the user-supplied function which implements the function raises an error, this error is returned in *ecp.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_call_ro_op_by_name_e().
Referenced by RDB_obj_equals().
int RDB_call_ro_op_by_name_e | ( | const char * | name, |
int | argc, | ||
RDB_object * | argv[], | ||
RDB_environment * | envp, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp, | ||
RDB_object * | retvalp | ||
) |
Same as RDB_call_ro_op_by_name() but with an additional argument envp. If txp is NULL and envp is not, envp is used to look up read-only operators from memory. If txp is not NULL, envp is ignored.
Referenced by RDB_call_ro_op_by_name().
int RDB_call_update_op | ( | RDB_operator * | op, |
int | argc, | ||
RDB_object * | argv[], | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Calls the update operator *op, passing the arguments in argc and argv.
If the user-supplied function which implements the operator raises an error, this error is returned in *ecp.
int RDB_call_update_op_by_name | ( | const char * | name, |
int | argc, | ||
RDB_object * | argv[], | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Invokes the update operator with the name name, passing the arguments in argc and argv.
The arguments must carry type information.
If the user-supplied function which implements the operator raises an error, this error is returned in *ecp.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_get_err(), RDB_get_update_op_by_args(), and RDB_obj_type().
int RDB_create_ro_op | ( | const char * | name, |
int | paramc, | ||
RDB_parameter | paramv[], | ||
RDB_type * | rtyp, | ||
const char * | libname, | ||
const char * | symname, | ||
const char * | sourcep, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Creates a read-only operator.
To execute the operator, DuroDBMS will execute the function specified by symname from the library specified by libname.
The name of the library must be passed without the file extension.
The function must have the following signature:
int <sym>(int argc, RDB_object *argv[], RDB_operator *op, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *retvalp)
When the function is executed, the operator is passed through op and the arguments are passed through argc and argv.
The function specified by symname must store the result at the location specified by retvalp and return RDB_OK. It can indicate an error condition by storing an error in *ecp (see RDB_raise_err()) and returning RDB_ERROR.
The return type is passed through rtyp.
sourcep may be NULL or a pointer to the source code implementing the operator.
Overloading operators is possible.
name | the name of the operator. |
paramc | the number of parameters. |
paramv | the parameters. paramv[i].typ will become the type of the i-th parameter. The update field is ignored. |
rtyp | the return type. |
libname | the name of a library containing the function which implements the operator. |
symname | the name of the C function which implements the operator. |
sourcep | a pointer to the source code, if the operator is executed by an interpreter. |
ecp | a pointer to a RDB_exec_context used to return error information. |
txp | the transaction which is used to write to the catalog. |
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_create_ro_op_version().
int RDB_create_ro_op_version | ( | const char * | name, |
const char * | version, | ||
int | paramc, | ||
RDB_parameter | paramv[], | ||
RDB_type * | rtyp, | ||
const char * | libname, | ||
const char * | symname, | ||
const char * | sourcep, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Like RDB_create_ro_op, but creates a read-only operator with a version name.
version | the operator version. If it is NULL, the operator is created without a version name. |
References RDB_alloc(), RDB_free(), and RDB_parameter::typ.
Referenced by RDB_create_ro_op().
int RDB_create_update_op | ( | const char * | name, |
int | paramc, | ||
RDB_parameter | paramv[], | ||
const char * | libname, | ||
const char * | symname, | ||
const char * | sourcep, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
RDB_create_update_op creates an update operator.
To execute the operator, DuroDBMS will execute the function specified by symname from the library specified by libname.
The name of the library must be passed without the file extension.
This function must have the following signature:
int <sym>(int argc, RDB_object *argv[], RDB_operator *op, RDB_exec_context *ecp, RDB_transaction *txp)
When the function is executed, the name of the operator is passed through name and the arguments are passed through argc and argv.
On success, the function specified by symname must return RDB_OK. It can indicate an error condition by leaving an error in *ecp (see RDB_raise_err() and related functions) and returning RDB_ERROR.
sourcep may be NULL or a pointer to the source code implementing the operator.
Overloading operators is possible.
name | the name of the operator. |
paramc | the number of parameters. |
paramv | the parameters. paramv[i].typ will become the type of the i-th parameter. paramv[i].update specifies whether the argument is updated. |
libname | the name of a library containing the function which implements the operator. |
symname | the name of the C function which implements the operator. |
sourcep | a pointer to the source code, if the operator is executed by an interpreter. |
ecp | a pointer to a RDB_exec_context used to return error information. |
txp | the transaction which is used to write to the catalog. |
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
int RDB_drop_op | ( | const char * | opname, |
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Deletes all read-only operators with the name name, if at least one such operator exists. Otherwise, all update operators with the that name are deleted.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_tx_is_running().
RDB_parameter * RDB_get_parameter | ( | const RDB_operator * | op, |
int | idx | ||
) |
Returns the idx-th parameter of *op
RDB_operator* RDB_get_update_op | ( | const char * | name, |
int | argc, | ||
RDB_type * | argtv[], | ||
RDB_environment * | envp, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Returns a pointer to an update operator with the name name whose signature matches the parameter types given by argc and argtv. A value of NULL in argtv matches any type.
If txp is NULL, envp is used to look up the operator in memory. If txp is not NULL, envp is ignored.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_get_err(), RDB_obj_type(), and RDB_tx_db().
RDB_operator* RDB_get_update_op_by_args | ( | const char * | name, |
int | argc, | ||
RDB_object * | argv[], | ||
RDB_environment * | envp, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Returns a pointer to the implemented update operator with the name name which matches the arguments given by argc and argv. A value of NULL in argtv matches any type.
If txp is NULL, envp is used to look up the operator in memory. If txp is not NULL, envp is ignored.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_get_err(), RDB_obj_type(), and RDB_tx_db().
Referenced by RDB_call_update_op_by_name().
RDB_object* RDB_operator_creation_time | ( | RDB_operator * | op | ) |
Returns the time operator *op was created.
const char * RDB_operator_name | ( | const RDB_operator * | op | ) |
Return the name of *op
int RDB_operator_param_count | ( | const RDB_operator * | op | ) |
Return number of parameters of operator *op.
const char * RDB_operator_source | ( | const RDB_operator * | op | ) |
Returns the source code of operator *op.
References RDB_obj_string().
RDB_type* RDB_operator_type | ( | const RDB_operator * | op | ) |
Returns the return type *op.
RDB_type * RDB_return_type | ( | const RDB_operator * | op | ) |
Return the return type of *op if it's a read-only operator. Return NULL if it's an update operator.
void RDB_set_op_cleanup_fn | ( | RDB_operator * | op, |
RDB_op_cleanup_func * | fp | ||
) |
Set function which is invoked when the *op is deleted from memory
References RDB_alloc(), RDB_del_nonscalar_type(), RDB_destroy_obj(), RDB_dup_nonscalar_type(), RDB_free(), RDB_init_obj(), RDB_raise_no_memory(), and RDB_type_is_scalar().