DuroDBMS API  1.2
Data Structures | Functions
Tuple functions

Data Structures

struct  RDB_renaming
 
struct  RDB_wrapping
 
struct  chained_obj_getters
 
struct  RDB_virtual_attr
 

Functions

int RDB_tuple_set (RDB_object *tplp, const char *attrname, const RDB_object *objp, RDB_exec_context *ecp)
 
int RDB_tuple_set_bool (RDB_object *tplp, const char *attrname, RDB_bool val, RDB_exec_context *ecp)
 
int RDB_tuple_set_int (RDB_object *tplp, const char *attrname, RDB_int val, RDB_exec_context *ecp)
 
int RDB_tuple_set_float (RDB_object *tplp, const char *attrname, RDB_float val, RDB_exec_context *ecp)
 
int RDB_tuple_set_string (RDB_object *tplp, const char *attrname, const char *str, RDB_exec_context *ecp)
 
RDB_object * RDB_tuple_get (const RDB_object *tplp, const char *attrname)
 
RDB_bool RDB_tuple_get_bool (const RDB_object *tplp, const char *attrname)
 
RDB_int RDB_tuple_get_int (const RDB_object *tplp, const char *attrname)
 
RDB_float RDB_tuple_get_float (const RDB_object *tplp, const char *attrname)
 
char * RDB_tuple_get_string (const RDB_object *tplp, const char *attrname)
 
RDB_int RDB_tuple_size (const RDB_object *tplp)
 
void RDB_tuple_attr_names (const RDB_object *tplp, char **namev)
 
int RDB_project_tuple (const RDB_object *tplp, int attrc, const char *attrv[], RDB_exec_context *ecp, RDB_object *restplp)
 
int RDB_remove_tuple (const RDB_object *tplp, int attrc, const char *attrv[], RDB_exec_context *ecp, RDB_object *restplp)
 
int RDB_rename_tuple (const RDB_object *tplp, int renc, const RDB_renaming renv[], RDB_exec_context *ecp, RDB_object *restup)
 
RDB_bool RDB_is_tuple (const RDB_object *objp)
 
int RDB_add_tuple (RDB_object *tpl1p, const RDB_object *tpl2p, RDB_exec_context *ecp, RDB_transaction *txp)
 
int RDB_union_tuples (const RDB_object *tpl1p, const RDB_object *tpl2p, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *restplp)
 
int RDB_extend_tuple (RDB_object *tplp, int attrc, const RDB_virtual_attr attrv[], RDB_getobjfn *getfnp, void *getarg, RDB_exec_context *ecp, RDB_transaction *txp)
 
int RDB_rename_tuple_ex (RDB_object *dtplp, const RDB_object *stplp, const RDB_expression *exp, RDB_exec_context *ecp)
 
int RDB_wrap_tuple (const RDB_object *tplp, int wrapc, const RDB_wrapping wrapv[], RDB_exec_context *ecp, RDB_object *restplp)
 
int RDB_unwrap_tuple (const RDB_object *tplp, int attrc, char *attrv[], RDB_exec_context *ecp, RDB_object *restplp)
 

Detailed Description

Function Documentation

int RDB_extend_tuple ( RDB_object *  tplp,
int  attrc,
const RDB_virtual_attr  attrv[],
RDB_getobjfn *  getfnp,
void *  getarg,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_extend_tuple extends the tuple specified by tplp by the attributes specified by attrc and attrv.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
name_error
One of the expressions specified in updv refers to an attribute which does not exist in the tuple.
invalid_argument_error
One of the additional attributes already exists in the original table.
operator_not_found_error
One of the expressions specified in updv refers to an operator which does not exist.

The call may also fail for a system error.

References RDB_destroy_obj(), RDB_evaluate(), RDB_init_obj(), and RDB_tuple_set().

RDB_bool RDB_is_tuple ( const RDB_object *  objp)

Check if *objp represents a tuple. Calling it with a newly initialized object will return RDB_TRUE.

References RDB_type_is_tuple().

int RDB_project_tuple ( const RDB_object *  tplp,
int  attrc,
const char *  attrv[],
RDB_exec_context *  ecp,
RDB_object *  restplp 
)

RDB_project_tuple creates a tuple which contains only the attributes specified by attrc and attrv.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
name_error
One of the attributes specified by attrv is not an attribute of the original tuple.

The call may also fail for a system error.

References RDB_destroy_obj(), RDB_init_obj(), RDB_raise_invalid_argument(), RDB_raise_name(), RDB_tuple_get(), and RDB_tuple_set().

int RDB_rename_tuple ( const RDB_object *  tplp,
int  renc,
const RDB_renaming  renv[],
RDB_exec_context *  ecp,
RDB_object *  restup 
)

RDB_rename_tuple creates copies the tuple specified by tplp to the tuple specified by restplp, renaming the attributes specified by renc and renv.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_raise_invalid_argument(), and RDB_tuple_set().

void RDB_tuple_attr_names ( const RDB_object *  tplp,
char **  namev 
)

RDB_tuple_attr_names fills namev with pointers to the attribute names of the tuple specified by tplp.

namev must be large enough for all attribute names. The pointers must not be modified by the caller and will become invalid when the tuple is destroyed.

RDB_object* RDB_tuple_get ( const RDB_object *  tplp,
const char *  attrname 
)

RDB_tuple_get returns a pointer to a RDB_object structure which contains the value for attribute name. The value is not copied.

Returns

A pointer to the value of the attribute, or NULL if no attribute with that name exists.

Referenced by RDB_get_dbs(), RDB_obj_matches_type(), RDB_obj_property(), RDB_project_tuple(), RDB_set_init_value(), RDB_table_contains(), RDB_tuple_get_bool(), RDB_tuple_get_float(), RDB_tuple_get_int(), RDB_tuple_get_string(), RDB_unwrap_tuple(), and RDB_wrap_tuple().

RDB_bool RDB_tuple_get_bool ( const RDB_object *  tplp,
const char *  attrname 
)

RDB_tuple_get_bool returns the value of attribute name as a RDB_bool. The attribute must exist and it must be of type boolean.

Returns

The attribute value.

References RDB_tuple_get().

RDB_float RDB_tuple_get_float ( const RDB_object *  tplp,
const char *  attrname 
)

Return the value of attribute name as a RDB_float. The attribute must exist and it must be of type float.

Returns

The attribute value.

References RDB_tuple_get().

RDB_int RDB_tuple_get_int ( const RDB_object *  tplp,
const char *  attrname 
)

RDB_tuple_get_int returns the value of attribute name as a RDB_int. The attribute must exist and it must be of type integer.

Returns

The attribute value.

References RDB_tuple_get().

char* RDB_tuple_get_string ( const RDB_object *  tplp,
const char *  attrname 
)

RDB_tuple_get_string returns a pointer to the value of attribute name. The attribute must exist and it must be of type string.

Returns

A pointer to the attribute value.

References RDB_tuple_get().

int RDB_tuple_set ( RDB_object *  tplp,
const char *  attrname,
const RDB_object *  objp,
RDB_exec_context *  ecp 
)

RDB_tuple_set sets the attribute name of the tuple variable specified by tplp to the value specified by objp.

If objp is NULL, the attribute value is set to an object that has been initialized using RDB_init_obj().

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_copy_obj(), RDB_destroy_obj(), and RDB_init_obj().

Referenced by RDB_create_ro_op_version(), RDB_define_subtype(), RDB_extend_tuple(), RDB_obj_set_property(), RDB_project_tuple(), RDB_rename_tuple(), RDB_set_init_value(), RDB_unwrap_tuple(), and RDB_wrap_tuple().

int RDB_tuple_set_bool ( RDB_object *  tplp,
const char *  attrname,
RDB_bool  val,
RDB_exec_context *  ecp 
)

RDB_tuple_set_bool sets the attribute name of the tuple variable specified by tplp to the boolean value specified by val.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_bool_to_obj().

Referenced by RDB_define_subtype().

int RDB_tuple_set_float ( RDB_object *  tplp,
const char *  attrname,
RDB_float  val,
RDB_exec_context *  ecp 
)

Set the attribute name of the tuple variable specified by tplp to the value specified by val.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_float_to_obj().

int RDB_tuple_set_int ( RDB_object *  tplp,
const char *  attrname,
RDB_int  val,
RDB_exec_context *  ecp 
)

RDB_tuple_set_int sets the attribute name of the tuple variable specified by tplp to the integer value specified by val.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_int_to_obj().

Referenced by RDB_define_subtype().

int RDB_tuple_set_string ( RDB_object *  tplp,
const char *  attrname,
const char *  str,
RDB_exec_context *  ecp 
)

Set the attribute name of the tuple variable specified by tplp to the value specified by str.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:

The call may fail for a system error.

References RDB_string_to_obj().

Referenced by RDB_create_ro_op_version(), and RDB_define_subtype().

RDB_int RDB_tuple_size ( const RDB_object *  tplp)

RDB_tuple_size returns the number of attributes of the tuple specified by tplp.

Returns

The number of attributes.

Referenced by RDB_obj_matches_type().

int RDB_union_tuples ( const RDB_object *  tpl1p,
const RDB_object *  tpl2p,
RDB_exec_context *  ecp,
RDB_transaction *  txp,
RDB_object *  restplp 
)

RDB_union_tuples creates a tuple which contains the attributes of the two tuples specified by tpl1p and tpl2p.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
type_mismatch_error
The two tuples have an attribute with the same name, but with different types.
invalid_argument_error
The two tuples have an attribute with the same name, but with different values.

The call may also fail for a system error.

References RDB_copy_obj().

int RDB_unwrap_tuple ( const RDB_object *  tplp,
int  attrc,
char *  attrv[],
RDB_exec_context *  ecp,
RDB_object *  restplp 
)

RDB_unwrap_tuple performs a tuple UNWRAP operator on the tuple pointed to by tplp and stores the result in the variable pointed to by restplp.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
name_error
An attribute specified by attrv does not exist.
invalid_argument_error
An attribute specified by attrv is not tuple-typed.

References RDB_raise_invalid_argument(), RDB_raise_name(), RDB_tuple_get(), and RDB_tuple_set().

int RDB_wrap_tuple ( const RDB_object *  tplp,
int  wrapc,
const RDB_wrapping  wrapv[],
RDB_exec_context *  ecp,
RDB_object *  restplp 
)

RDB_wrap_tuple performs a tuple WRAP operator on the tuple pointed to by tplp and stores the result in the variable pointed to by restplp.

If an error occurs, an error value is left in *ecp.

Returns

RDB_OK on success, RDB_ERROR if an error occurred.

Errors:
name_error
One or more of the attributes specified by wrapv[i].attrv does not exist.

References RDB_destroy_obj(), RDB_init_obj(), RDB_raise_name(), RDB_tuple_get(), and RDB_tuple_set().