Functions | |
| int | RDB_implement_type (const char *name, RDB_type *arep, RDB_int areplen, RDB_exec_context *ecp, RDB_transaction *txp) |
| 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_implement_type 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 -1, 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.
If arep is NULL and areplen is -1, 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 property, the type of this representation will become the physical representation. Otherwise the type will be represented by a tuple type with one attribute for each property.
For user-provided setters, getters, and selectors, the following conventions apply:
A user-defined comparison operator CMP returning an INTEGER may be supplied. CMP must have two arguments, both of the user-defined type for which the comparison is to be defined.
CMP must return -1, 0, or 1 if the first argument is lower than equal to, or greater than the secons argument, respectively.
If CMP has been defined, it will be called by the built-in comparison operators =, <>, <= etc.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| int RDB_irep_to_obj | ( | RDB_object * | valp, | |
| RDB_type * | typ, | |||
| const void * | datap, | |||
| size_t | len, | |||
| RDB_exec_context * | ecp | |||
| ) |
Initialize the value pointed to by valp with the internal representation given by datap and len.
| void* RDB_obj_irep | ( | RDB_object * | valp, | |
| size_t * | lenp | |||
| ) |
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 types with a binary internal representation. These are built-in types and user-defined types which use a built-in type or a byte array as physical representation.
1.5.1