Operator functions


Functions

int RDB_create_ro_op (const char *name, int argc, RDB_type *argtv[], RDB_type *rtyp, const char *libname, const char *symname, const void *iargp, size_t iarglen, RDB_exec_context *ecp, RDB_transaction *txp)
int RDB_create_update_op (const char *name, int argc, RDB_type *argtv[], RDB_bool updv[], const char *libname, const char *symname, const void *iargp, size_t iarglen, RDB_exec_context *ecp, RDB_transaction *txp)
int RDB_call_ro_op (const char *name, int argc, RDB_object *argv[], RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *retvalp)
int RDB_call_update_op (const char *name, int argc, RDB_object *argv[], RDB_exec_context *ecp, RDB_transaction *txp)
int RDB_drop_op (const char *name, RDB_exec_context *ecp, RDB_transaction *txp)

Function Documentation

int RDB_call_ro_op ( const char *  name,
int  argc,
RDB_object argv[],
RDB_exec_context *  ecp,
RDB_transaction *  txp,
RDB_object retvalp 
)

RDB_call_ro_op 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.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NO_RUNNING_TX_ERROR
txp is not NULL and *txp is not a running transaction.
RDB_OPERATOR_NOT_FOUND_ERROR
A read-only operator that matches the name and argument types could not be found.
RDB_TYPE_MISMATCH_ERROR
A read-only operator that matches name could be found, but it does not match the argument types.

If txp</var 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.

int RDB_call_update_op ( const char *  name,
int  argc,
RDB_object argv[],
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_call_update_op invokes the update operator with the name name, passing the arguments in argc and argv. The arguments must carry type information.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NO_RUNNING_TX_ERROR
txp does not point to a running transaction.
RDB_OPERATOR_NOT_FOUND_ERROR
An update operator that matches the name and arguments could not be found.

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.

int RDB_create_ro_op ( const char *  name,
int  argc,
RDB_type *  argtv[],
RDB_type *  rtyp,
const char *  libname,
const char *  symname,
const void *  iargp,
size_t  iarglen,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_create_ro_op creates a read-only operator with name name. The argument types are specified by argc and argtv.

To execute the operator, Duro will execute the function specified by sym 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>(const char *name, int argc, RDB_object *argv[],
          const void *iargp, size_t iarglen, RDB_exec_context *ecp, RDB_transaction *txp,
          RDB_object *retvalp)

When the function is executed, the name of the operator is passed through name and the arguments are passed through argc and argv.

The function specified by sym must store the result at the location specified by retvalp and return RDB_OK. It can indicate an error condition by leaving an error in *ecp (see RDB_raise_err()) and returning RDB_ERROR.

If iargp is not NULL, it must point to a byte block of length iarglen which will be passed to the function specified by sym. This can be used to pass code to an interpreter function.

Overloading operators is possible.

Array-valued return types are not supported.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NO_RUNNING_TX_ERROR
txp does not point to a running transaction.
RDB_ELEMENT_EXIST_ERROR
A read-only operator with this name and signature does already exist.
RDB_NOT_SUPPORTED_ERROR
The return type is an array type.

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

int RDB_create_update_op ( const char *  name,
int  argc,
RDB_type *  argtv[],
RDB_bool  updv[],
const char *  libname,
const char *  symname,
const void *  iargp,
size_t  iarglen,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_create_update_op creates an update operator with name name. The argument types are specified by argc and argtv.

The argument upd specifies which of the arguments are updated. If upd[i] is RDB_TRUE, this indicates that the ith argument is updated by the operator.

To execute the operator, Duro will execute the function specified by sym 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>(const char *name, int argc, RDB_object *argv[],
        RDB_bool updv[], const void *iargp, size_t iarglen,
        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 sym 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.

If iargp is not NULL, it must point to a byte block of length iarglen which will be passed to the function specified by sym. This can be used to pass code to an interpreter function.

Overloading operators is possible.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NO_RUNNING_TX_ERROR
txp does not point to a running transaction.
RDB_ELEMENT_EXIST_ERROR
An update operator with this name and signature does already exist.

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 *  name,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_drop_op deletes the operator with the name name from the database. This affects all overloaded versions.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NO_RUNNING_TX_ERROR
txp does not point to a running transaction.
RDB_OPERATOR_NOT_FOUND_ERROR
An operator with the specified name could not be found.

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


Generated on Tue Mar 11 23:48:15 2008 for Duro by  doxygen 1.5.1