Array functions


Data Structures

struct  RDB_seq_item

Functions

int RDB_table_to_array (RDB_object *arrp, RDB_object *tbp, int seqitc, const RDB_seq_item seqitv[], int flags, RDB_exec_context *ecp, RDB_transaction *txp)
RDB_objectRDB_array_get (RDB_object *arrp, RDB_int idx, RDB_exec_context *ecp)
RDB_int RDB_array_length (RDB_object *arrp, RDB_exec_context *ecp)
int RDB_set_array_length (RDB_object *arrp, RDB_int len, RDB_exec_context *ecp)
int RDB_array_set (RDB_object *arrp, RDB_int idx, const RDB_object *objp, RDB_exec_context *ecp)

Function Documentation

RDB_object* RDB_array_get ( RDB_object arrp,
RDB_int  idx,
RDB_exec_context *  ecp 
)

RDB_array_get returns a pointer to the RDB_object at index idx. This pointer may become invalid after the next invocation of RDB_array_get(). The pointer will become invalid when the array is destroyed.

Returns:
A pointer to the array element, or NULL if an error occurred.
Errors:
RDB_NOT_FOUND_ERROR
idx exceeds the array length.
RDB_OPERATOR_NOT_FOUND_ERROR
The array was created from a table which refers to a non-existing operator.
The call may also fail for a system error.

RDB_int RDB_array_length ( RDB_object arrp,
RDB_exec_context *  ecp 
)

RDB_array_length returns the length of an array.

Returns:
The length of the array. A return code lower than zero indicates an error.
Errors:
RDB_OPERATOR_NOT_FOUND_ERROR
The array was created from a table which refers to a non-existing operator.
The call may also fail for a system error.

int RDB_array_set ( RDB_object arrp,
RDB_int  idx,
const RDB_object objp,
RDB_exec_context *  ecp 
)

RDB_array_set copies the RDB_object pointed to by tplp into the RDB_object at index idx.

RDB_array_set is not supported for arrays which have been created using RDB_table_to_array with the RDB_UNBUFFERED flag.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NOT_FOUND_ERROR
idx exceeds the array length.
RDB_NOT_SUPPORTED_ERROR
The table has been created using RDB_table_to_array with the RDB_UNBUFFERED flag.
The call may also fail for a system error.

int RDB_set_array_length ( RDB_object arrp,
RDB_int  len,
RDB_exec_context *  ecp 
)

RDB_set_array_length sets the length of the array specified by arrp.

This function is not supported for arrays which have been created using RDB_table_to_array with the RDB_UNBUFFERED flag.

Returns:
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
RDB_NOT_SUPPORTED_ERROR
The array has been created using RDB_table_to_array with the RDB_UNBUFFERED flag.

int RDB_table_to_array ( RDB_object arrp,
RDB_object tbp,
int  seqitc,
const RDB_seq_item  seqitv[],
int  flags,
RDB_exec_context *  ecp,
RDB_transaction *  txp 
)

RDB_table_to_array creates an array which contains all tuples from the table specified by tbp. If seqitc is zero, the order of the tuples is undefined. If seqitc is greater than zero, the order of the tuples is specified by seqitv.

Parameters:
flags Must be 0 or RDB_UNBUFFERED. If flags is set to RDB_UNBUFFERED, an array access will result in an access to *tbp with the following consequences:
  • *tbp must not be deleted before the array is destroyed.
  • *arrp will become inaccessible if the transaction is committed or rolled back.
  • Write access to *arrp is not supported.
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_OPERATOR_NOT_FOUND_ERROR
The definition of the table specified by tbp refers to a non-existing operator.
RDB_INVALID_ARGUMENT
*arrp is neither newly initialized nor an array.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.


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