Type functions


Modules

 Type implementation functions

Data Structures

struct  RDB_possrep

Functions

RDB_type * RDB_get_type (const char *name, RDB_exec_context *ecp, RDB_transaction *txp)
RDB_bool RDB_type_is_numeric (const RDB_type *typ)
RDB_type * RDB_dup_nonscalar_type (RDB_type *typ, RDB_exec_context *ecp)
RDB_type * RDB_create_tuple_type (int attrc, const RDB_attr attrv[], RDB_exec_context *ecp)
RDB_type * RDB_create_relation_type (int attrc, const RDB_attr attrv[], RDB_exec_context *ecp)
RDB_type * RDB_create_relation_type_from_base (RDB_type *tpltyp, RDB_exec_context *ecp)
RDB_type * RDB_create_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_attrRDB_type_attrs (RDB_type *typ, int *attrc)
int RDB_define_type (const char *name, int repc, const RDB_possrep repv[], RDB_expression *constraintp, RDB_exec_context *ecp, RDB_transaction *txp)
int RDB_drop_type (RDB_type *typ, RDB_exec_context *ecp, RDB_transaction *txp)
RDB_bool RDB_type_equals (const RDB_type *typ1, const RDB_type *typ2)
char * RDB_type_name (const RDB_type *typ)

Function Documentation

RDB_type* RDB_create_array_type ( RDB_type *  basetyp,
RDB_exec_context *  ecp 
)

RDB_create_array_type creates an array type. The base type is specified by typ.

Returns:
The new array type, or NULL if the creation failed due to insufficient memory.

RDB_type* RDB_create_relation_type ( int  attrc,
const RDB_attr  attrv[],
RDB_exec_context *  ecp 
)

Create a relation type and return a pointer to it. The attributes are specified by attrc and attrv. The fields defaultp and options of RDB_attr are ignored.

Returns:
On success, a pointer to the type. On failure, NULL is returned.

Errors:
RDB_INVALID_ARGUMENT_ERROR
attrv contains two attributes with the same name.

The call may also fail for a system error.

RDB_type* RDB_create_relation_type_from_base ( RDB_type *  tpltyp,
RDB_exec_context *  ecp 
)

Create a relation type from a tuple type.

Returns:
On success, a pointer to the type. On failure, NULL is returned.

Errors:
The call may fail for a system error.

RDB_type* RDB_create_tuple_type ( int  attrc,
const RDB_attr  attrv[],
RDB_exec_context *  ecp 
)

RDB_create_tuple_type creates a tuple type and stores a pointer to the type at the location pointed to by typp. The attributes are specified by attrc and attrv. The fields defaultp and options of RDB_attr are ignored.

Returns:
A pointer to the tuple type, or NULL if an error occured.

Errors:
RDB_INVALID_ARGUMENT_ERROR
attrv contains two attributes with the same name.

The call may also fail for a system error.

int RDB_define_type ( const char *  name,
int  repc,
const RDB_possrep  repv[],
RDB_expression *  constraintp,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_define_type 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 to check is made available as an attribute with the same name as the type.

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
There is already a type with name name.

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

int RDB_drop_type ( RDB_type *  typ,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_drop_type destroys the type specified by typ.

If the type is a scalar user-defined type, it is deleted from the database.

If the type is non-scalar, the argument txp is ignored.

It is not possible to destroy built-in types.

Returns:
On success, RDB_OK is returned. Any other return value indicates an error.

Errors:
RDB_NO_RUNNING_TX_ERROR
The type is scalar and txp does not point to a running transaction.
RDB_INVALID_ARGUMENT_ERROR
The type is a builtin type.

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

RDB_type* RDB_dup_nonscalar_type ( RDB_type *  typ,
RDB_exec_context *  ecp 
)

If *typ is non-scalar, RDB_dup_nonscalar_creates a copy of it.

Returns:
A pointer to a copy of *typ, if *typ is non-scalar. typ, if *typ is scalar.

If the operation fails, NULL is returned.

RDB_type* RDB_get_type ( const char *  name,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

Return a pointer to RDB_type structure which represents the type with the name name.

Returns:
The pointer to the type on success, or NULL if an error occured.

Errors:
RDB_NOT_FOUND_ERROR
A type with the name name could not be found.
The type name is not a built-in type and txp is NULL.

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

RDB_attr* RDB_type_attrs ( RDB_type *  typ,
int *  attrc 
)

RDB_type_attrs returns a pointer to an array of RDB_attr structures describing the attributes of the tuple or relation type specified by *typ and stores the number of attributes in attrcp.

Returns:
A pointer to an array of RDB_attr structures or NULL if the type is not a tuple or relation type.

RDB_bool RDB_type_equals ( const RDB_type *  typ1,
const RDB_type *  typ2 
)

RDB_type_equals checks if two types are equal.

Nonscalar types are equal if there definition is the same.

Returns:
RDB_TRUE if the types are equal, RDB_FALSE otherwise.

RDB_bool RDB_type_is_numeric ( const RDB_type *  typ  ) 

RDB_type_is_numeric checks if a type is numeric.

Returns:
RDB_TRUE if the type is INTEGER or FLOAT, RDB_FALSE otherwise.

RDB_bool RDB_type_is_relation ( const RDB_type *  typ  ) 

Checks if a type is a relation type.

Returns:
RDB_TRUE if the *typ is a relation type, RDB_FALSE if not.

RDB_bool RDB_type_is_scalar ( const RDB_type *  typ  ) 

RDB_type_is_scalar checks if a type is scalar.

Returns:
RDB_TRUE if the type is scalar, RDB_FALSE if not.

RDB_bool RDB_type_is_tuple ( const RDB_type *  typ  ) 

Checks if a type is a relation type.

Returns:
RDB_TRUE if the *typ is a relation type, RDB_FALSE if not.

char* RDB_type_name ( const RDB_type *  typ  ) 

RDB_type_name returns the name of a type.

Returns:
A pointer to the name of the type or NULL if the type has no name.


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