DuroDBMS API  1.7
Data Structures | Functions
Array functions

Data Structures

struct  RDB_seq_item
 

Functions

RDB_object * RDB_array_get (const RDB_object *arrp, RDB_int idx, RDB_exec_context *ecp)
 
RDB_int RDB_array_length (const 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)
 
RDB_bool RDB_is_array (const RDB_object *objp)
 
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)
 

Detailed Description

#include <rel/rdb.h>

Function Documentation

◆ RDB_array_get()

RDB_object* RDB_array_get ( const 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:
not_found_error
idx exceeds the array length.
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_array_length()

RDB_int RDB_array_length ( const 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:
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.

Referenced by RDB_is_array().

◆ RDB_array_set()

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.

Returns
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
not_found_error
idx exceeds the array length.

The call may also fail for a system error.

◆ RDB_is_array()

RDB_bool RDB_is_array ( const RDB_object *  objp)

Checks if *objp is an array.

References RDB_array_length(), and RDB_type_is_array().

◆ RDB_set_array_length()

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.

Returns
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:

The call may also fail for a system error.

References RDB_alloc(), RDB_destroy_obj(), RDB_free(), RDB_init_obj(), and RDB_realloc().

Referenced by RDB_set_init_value().

◆ RDB_table_to_array()

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 
)

Create 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
flagsCurrently unused and should be set to zero
Returns
RDB_OK on success, RDB_ERROR if an error occurred.
Errors:
no_running_tx_error
txp does not point to a running transaction.
operator_not_found_error
The definition of the table specified by tbp refers to a non-existing operator.
invalid_argument_error
*arrp is neither newly initialized nor an array. The table represented by *tbp does not exist. (e.g. after a rollback) One of the attributes in seqitv does not exist or is not of an ordered type.

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