DuroDBMS API
1.7
|
Modules | |
Type implementation functions | |
Data Structures | |
struct | RDB_possrep |
Enumerations | |
enum | { RDB_TYPE_ORDERED = 1, RDB_TYPE_UNION = 2 } |
Functions | |
RDB_bool | RDB_type_is_numeric (const RDB_type *typ) |
RDB_bool | RDB_type_is_valid (const RDB_type *typ) |
RDB_bool | RDB_type_is_ordered (const RDB_type *typ) |
RDB_bool | RDB_type_depends_type (const RDB_type *typ, const RDB_type *dtyp) |
RDB_bool | RDB_type_has_possreps (const RDB_type *typ) |
RDB_possrep * | RDB_type_possreps (const RDB_type *typ, int *possrepcp) |
RDB_possrep * | RDB_comp_possrep (const RDB_type *typ, const char *name) |
RDB_attr * | RDB_type_property (const RDB_type *typ, const char *propname) |
RDB_type * | RDB_dup_nonscalar_type (RDB_type *typ, RDB_exec_context *ecp) |
RDB_type * | RDB_new_scalar_type (const char *name, RDB_int ireplen, RDB_bool sysimpl, RDB_bool ordered, RDB_exec_context *ecp) |
RDB_type * | RDB_new_tuple_type (int attrc, const RDB_attr attrv[], RDB_exec_context *ecp) |
RDB_type * | RDB_new_relation_type (int attrc, const RDB_attr attrv[], RDB_exec_context *ecp) |
RDB_type * | RDB_new_relation_type_from_base (RDB_type *tpltyp, RDB_exec_context *ecp) |
RDB_type * | RDB_new_array_type (RDB_type *basetyp, RDB_exec_context *ecp) |
RDB_bool | RDB_type_is_scalar (const RDB_type *typ) |
RDB_bool | RDB_type_is_relation (const RDB_type *typ) |
RDB_bool | RDB_type_is_tuple (const RDB_type *typ) |
RDB_bool | RDB_type_is_array (const RDB_type *typ) |
RDB_type * | RDB_base_type (const RDB_type *typ) |
RDB_attr * | RDB_type_attrs (RDB_type *typ, int *attrcp) |
int | RDB_del_nonscalar_type (RDB_type *typ, RDB_exec_context *ecp) |
RDB_bool | RDB_type_equals (const RDB_type *typ1, const RDB_type *typ2) |
char * | RDB_type_name (const RDB_type *typ) |
RDB_bool | RDB_is_subtype (const RDB_type *typ1, const RDB_type *typ2) |
RDB_bool | RDB_share_subtype (const RDB_type *typ1, const RDB_type *typ2) |
void | RDB_lock_type (RDB_type *typ) |
void | RDB_set_cleanup (RDB_type *typ, RDB_obj_cleanup_func *cleanup_fp) |
int | RDB_define_type (const char *name, int repc, const RDB_possrep repv[], RDB_expression *constraintp, RDB_expression *initexp, int flags, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_define_subtype (const char *name, int supertypec, RDB_type *supertypev[], int repc, const RDB_possrep repv[], RDB_expression *constraintp, RDB_expression *initexp, int flags, RDB_exec_context *ecp, RDB_transaction *txp) |
int | RDB_drop_type (const char *name, RDB_exec_context *ecp, RDB_transaction *txp) |
RDB_bool | RDB_is_selector (const RDB_operator *op) |
RDB_type * | RDB_get_type (const char *name, RDB_exec_context *ecp, RDB_transaction *txp) |
Return the base type of a relation or array type.
RDB_possrep* RDB_comp_possrep | ( | const RDB_type * | typ, |
const char * | name | ||
) |
Returns a pointer to a RDB_possrep structure representing the possible representation of type typ containing a component named name. The structure is managed by the type.
int RDB_define_subtype | ( | const char * | name, |
int | supertypec, | ||
RDB_type * | supertypev[], | ||
int | repc, | ||
const RDB_possrep | repv[], | ||
RDB_expression * | constraintp, | ||
RDB_expression * | initexp, | ||
int | flags, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Defines a type like RDB_define_type, but allows to specify supertypes using the arguments supertypec and supertypev.
References RDB_tx_is_running().
Referenced by RDB_define_type().
int RDB_define_type | ( | const char * | name, |
int | repc, | ||
const RDB_possrep | repv[], | ||
RDB_expression * | constraintp, | ||
RDB_expression * | initexp, | ||
int | flags, | ||
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Defines a type with the name name and repc possible representations. The individual possible representations are described by the elements of repv.
If constraintp is not NULL, it specifies the type constraint. When the constraint is evaluated, the value of components are available under the name of the respective component.
initexp specifies the initializer. The expression must be of the type being defined.
flags must be 0 or constructed by bitwise OR-ing one or more of the following values:
RDB_OK on success, RDB_ERROR if an error occurred.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
References RDB_define_subtype().
int RDB_del_nonscalar_type | ( | RDB_type * | typ, |
RDB_exec_context * | ecp | ||
) |
Delete *typ from memory. The type must be non-scalar.
References RDB_del_nonscalar_type(), RDB_free(), and RDB_type_is_scalar().
Referenced by RDB_del_nonscalar_type(), RDB_destroy_obj(), RDB_expr_is_table_ref(), RDB_init_table(), RDB_set_init_value(), and RDB_set_op_cleanup_fn().
int RDB_drop_type | ( | const char * | name, |
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Deletes the user-defined type with name specified by name.
It is not possible to destroy built-in types.
If a selector operator is present, it will be deleted.
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_tx_is_running().
If *typ is non-scalar, RDB_dup_nonscalar_creates a copy of it.
A pointer to a copy of *typ, if *typ is non-scalar. typ, if *typ is scalar.
If the operation fails, NULL is returned.
References RDB_alloc(), RDB_dup_nonscalar_type(), RDB_free(), and RDB_new_tuple_type().
Referenced by RDB_copy_obj_data(), RDB_dup_nonscalar_type(), RDB_expr_is_table_ref(), RDB_set_cleanup(), RDB_set_init_value(), and RDB_set_op_cleanup_fn().
RDB_type* RDB_get_type | ( | const char * | name, |
RDB_exec_context * | ecp, | ||
RDB_transaction * | txp | ||
) |
Returns a pointer to RDB_type structure which represents the type with the name name.
The pointer to the type on success, or NULL if an error occured.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
RDB_bool RDB_is_selector | ( | const RDB_operator * | op | ) |
Determines if the operator *op is a selector.
Determines if *typ1 is a subtype of *typ2. Note that the subtype relationship is reflexive.
References RDB_is_subtype(), RDB_type_equals(), and RDB_attr::typ.
Referenced by RDB_is_subtype(), RDB_set_cleanup(), RDB_share_subtype(), and RDB_type_depends_type().
void RDB_lock_type | ( | RDB_type * | typ | ) |
Mark *typ as locked. If a scalar type is locked its memory is not freed.
Creates a RDB_type struct for an array type. The base type is specified by typ.
A pointer to a RDB_type structure for the new array type, or NULL if the creation failed.
References RDB_alloc().
Creates a RDB_type struct for a relation type and returns a pointer to it. The attributes are specified by attrc and attrv. The fields defaultp and options of RDB_attr are ignored.
On success, a pointer to the RDB_type struct. On failure, NULL is returned.
The call may also fail for a system error.
References RDB_new_relation_type_from_base(), and RDB_new_tuple_type().
Referenced by RDB_copy_obj_data(), RDB_create_public_table(), RDB_create_table(), and RDB_init_table().
Creates a RDB_type struct for a relation type from a tuple type.
On success, a pointer to the RDB_type struct. On failure, NULL is returned.
The call may fail for a system error.
References RDB_alloc().
Referenced by RDB_new_relation_type().
RDB_type* RDB_new_scalar_type | ( | const char * | name, |
RDB_int | ireplen, | ||
RDB_bool | sysimpl, | ||
RDB_bool | ordered, | ||
RDB_exec_context * | ecp | ||
) |
Create a RDB_type struct for a scalar type and returns a pointer to it.
References RDB_alloc(), RDB_free(), and RDB_raise_no_memory().
Creates a RDB_type struct for a tuple type and returns a pointer to it. The attributes are specified by attrc and attrv. The fields defaultp and options of RDB_attr are ignored.
A pointer to the RDB_type struct, or NULL if an error occured.
The call may also fail for a system error.
References RDB_alloc(), and RDB_free().
Referenced by RDB_dup_nonscalar_type(), and RDB_new_relation_type().
void RDB_set_cleanup | ( | RDB_type * | typ, |
RDB_obj_cleanup_func * | cleanup_fp | ||
) |
Sets a function which is invoked when an RDB_object with this type is destroyed
References RDB_alloc(), RDB_dup_nonscalar_type(), RDB_free(), RDB_is_subtype(), RDB_raise_no_memory(), RDB_type_equals(), and RDB_attr::typ.
Determines if there is a type which is a subtype of both *typ1 and *typ2.
References RDB_is_subtype(), RDB_share_subtype(), and RDB_type_is_scalar().
Referenced by RDB_share_subtype().
RDB_type_attrs returns a pointer to an array of RDB_attr structs describing the attributes of the tuple or relation type specified by *typ and stores the number of attributes in attrcp.
The pointer returned must no longer be used if the RDB_type structure has been destroyed.
A pointer to an array of RDB_attr structs or NULL if the type is not a tuple or relation type.
Referenced by RDB_table_attrs().
Determines if *typ depends on *dtyp.
References RDB_is_subtype(), and RDB_type_depends_type().
Referenced by RDB_type_depends_type().
Check if two types are equal.
Nonscalar types are equal if their definition is the same.
RDB_TRUE if the types are equal, RDB_FALSE otherwise.
References RDB_type_equals().
Referenced by RDB_is_subtype(), RDB_set_cleanup(), RDB_subset(), RDB_table_attrs(), and RDB_type_equals().
RDB_bool RDB_type_has_possreps | ( | const RDB_type * | typ | ) |
Check if a type is a scalar type with possreps.
RDB_bool RDB_type_is_array | ( | const RDB_type * | typ | ) |
Checks if a type is an array type.
Referenced by RDB_is_array().
RDB_bool RDB_type_is_numeric | ( | const RDB_type * | typ | ) |
Check if a type is numeric.
RDB_bool RDB_type_is_ordered | ( | const RDB_type * | typ | ) |
Determines if a scalar type is ordered.
References RDB_type_is_scalar().
Referenced by RDB_type_is_valid().
RDB_bool RDB_type_is_relation | ( | const RDB_type * | typ | ) |
Checks if a type is a relation type.
RDB_TRUE if *typ is a relation type, RDB_FALSE if not.
Referenced by RDB_set_init_value().
RDB_bool RDB_type_is_scalar | ( | const RDB_type * | typ | ) |
RDB_type_is_scalar checks if a type is scalar.
RDB_TRUE if *typ is scalar, RDB_FALSE if not.
Referenced by RDB_del_nonscalar_type(), RDB_destroy_obj(), RDB_drop_typeimpl_ops(), RDB_expr_is_table_ref(), RDB_irep_to_obj(), RDB_obj_property(), RDB_obj_set_typeinfo(), RDB_set_op_cleanup_fn(), RDB_share_subtype(), and RDB_type_is_ordered().
RDB_bool RDB_type_is_tuple | ( | const RDB_type * | typ | ) |
Checks if a type is a tuple type.
RDB_TRUE if *typ is a tuple type, RDB_FALSE if not.
Referenced by RDB_is_tuple().
RDB_bool RDB_type_is_valid | ( | const RDB_type * | typ | ) |
Determines if a type is valid, that is, if it can be used for declaring variables. A scalar type is valid if it is implemented (either a built-in type or a user-defined type on which RDB_implement_type() has been called successfully). A non-scalar type is valid if its base/attribute types are valid.
References RDB_type_is_ordered(), and RDB_type_is_valid().
Referenced by RDB_type_is_valid().
char* RDB_type_name | ( | const RDB_type * | typ | ) |
Returns the name of a type.
A pointer to the name of the type or NULL if the type has no name.
Referenced by Duro_print_error_f().
RDB_possrep* RDB_type_possreps | ( | const RDB_type * | typ, |
int * | possrepcp | ||
) |
Returns a pointer to the possible represenations of a scalar type.