DuroDBMS API 1.2
|void *||RDB_obj_irep (RDB_object *valp, size_t *lenp)|
|int||RDB_irep_to_obj (RDB_object *valp, RDB_type *typ, const void *datap, size_t len, RDB_exec_context *ecp)|
|int||RDB_implement_type (const char *name, RDB_type *arep, RDB_int areplen, RDB_exec_context *ecp, RDB_transaction *txp)|
|RDB_bool||RDB_is_getter (const RDB_operator*op)|
|RDB_bool||RDB_is_setter (const RDB_operator*op)|
|RDB_bool||RDB_is_comparer (const RDB_operator*op)|
|int||RDB_drop_typeimpl_ops (const RDB_type *typ, RDB_exec_context *ecp, RDB_transaction *txp)|
|int RDB_drop_typeimpl_ops||(||const RDB_type *||typ,|
|int RDB_implement_type||(||const char *||name,|
Implements the user-defined type with name name. The type must have been defined previously using RDB_define_type(). After RDB_implement_type was inkoved successfully, this type may be used for local variables and table attributes.
If arep is not NULL, it must point to a type which is used as the physical representation. The getter, setter, and selector operators must be provided by the caller.
If arep is NULL and areplen is not RDB_SYS_REP, areplen specifies the length, in bytes, of the physical representation, which then is a fixed-length array of bytes. The getter, setter, and selector operators must be provided by the caller. RDB_irep_to_obj() can be used by the selector to assign a value to an RDB_object. RDB_obj_irep() can be used by setters and getters to access the actual representation.
If arep is NULL and areplen is RDB_SYS_REP, the getter and setter operators and the selector operator are provided by Duro. In this case, the type must have exactly one possible representation. If this representation has exactly one component, the type of this component will become the physical representation. Otherwise the type will be represented by a tuple type with one attribute for each component.
For user-provided setters, getters, and selectors, the following conventions apply:
_get_). It takes one argument. The argument must be of the user-defined type in question. The return type must be the component type.
_set_). It takes two arguments. The first argument is an update argument and must be of the user-defined type in question. The second argument is read-only and must be of the type of the component.
If the type is ordered, a user-defined comparison operator returning an
integer may be supplied. The comparison operator must be a read-only operator whose name consists of the type name and RDB_COMPARER_SUFFIX (
_cmp). It takes two arguments, both of the user-defined type in question.
It must return a value lower than, equal to, or greater than zero if the first argument is lower than, equal to, or greater than the second argument, respectively.
If the operator has been defined, it will be called by the built-in comparison operators =, <>, <= etc.
If the operator has not been provided for an ordered type that has only one possible representation consisting of components of ordered types, the built-in comparison operators =, <>, <= are implemented by DuroDBMS based on that possible representation. Otherwise, if the type is ordered but does not have only one possible representation consisting of components of ordered types, the comparison operator must be provided.
Invoking comparison operators on user-implemented types may fail when there is no running transaction because a running transaction may be required to access the user-defined property getter operator.
On success, RDB_OK is returned. Any other return value indicates an error.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_add_arg(), RDB_bool_to_expr(), RDB_del_expr(), RDB_destroy_obj(), RDB_dup_nonscalar_type(), RDB_evaluate(), RDB_get_type(), RDB_init_obj(), RDB_int_to_expr(), RDB_new_tuple_type(), RDB_obj_to_expr(), RDB_raise_invalid_argument(), RDB_raise_no_memory(), RDB_raise_no_running_tx(), RDB_ro_op(), RDB_string_to_expr(), RDB_tx_is_running(), RDB_type_is_ordered(), RDB_update(), and RDB_var_ref().
|int RDB_irep_to_obj||(||RDB_object *||valp,|
|const void *||datap,|
Initializes the value pointed to by valp with the internal representation given by datap and len.
len The length of the internal represenation in bytes. datap A pointer to the internal representation. If datap is NULL, len bytes are allocated but the internal representation is undefined.
RDB_OK on success, RDB_ERROR on failure.
|RDB_bool RDB_is_comparer||(||const RDB_operator*||op||)|
Determines if the operator *op is a comparison operator returning int.
|RDB_bool RDB_is_getter||(||const RDB_operator*||op||)|
Determines if the operator *op is a getter operator.
|RDB_bool RDB_is_setter||(||const RDB_operator*||op||)|
Determines if the operator *op is a setter operator.
|void* RDB_obj_irep||(||RDB_object *||valp,|
RDB_obj_irep returns a pointer to the binary internal representation of the variable specified by valp. If lenp is not NULL, the size of the internal representation is stored at the location pointed to by lenp.
RDB_obj_irep only works for types with a binary internal representation. These are built-in scalar types and user-defined types which use a built-in scalar type or a byte array as physical representation.
A pointer to the internal representation.