|
DuroDBMS API
0.17
|
Data Structures | |
| struct | RDB_attr |
| struct | RDB_string_vec |
Functions | |
| int | RDB_all (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| int | RDB_any (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| int | RDB_max (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *resultp) |
| int | RDB_min (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *resultp) |
| int | RDB_sum (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *resultp) |
| int | RDB_avg (RDB_object *tbp, const char *attrname, RDB_exec_context *ecp, RDB_transaction *txp, RDB_float *resultp) |
| int | RDB_table_is_empty (RDB_object *tbp, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| RDB_int | RDB_cardinality (RDB_object *tbp, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_table_contains (RDB_object *tbp, const RDB_object *tplp, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| RDB_object * | RDB_create_table (const char *name, int attrc, const RDB_attr attrv[], int keyc, const RDB_string_vec keyv[], RDB_exec_context *ecp, RDB_transaction *txp) |
| RDB_object * | RDB_create_table_from_type (const char *name, RDB_type *reltyp, int keyc, const RDB_string_vec keyv[], int default_attrc, const RDB_attr default_attrv[], RDB_exec_context *ecp, RDB_transaction *txp) |
| RDB_object * | RDB_get_table (const char *name, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_drop_table (RDB_object *tbp, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_set_table_name (RDB_object *tbp, const char *name, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_add_table (RDB_object *tbp, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_table_matching_tuple (RDB_object *tbp, const RDB_object *tplp, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| RDB_int | RDB_move_tuples (RDB_object *dstp, RDB_object *srcp, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_init_table_from_type (RDB_object *tbp, const char *name, RDB_type *reltyp, int keyc, const RDB_string_vec keyv[], int default_attrc, const RDB_attr *default_attrv, RDB_exec_context *ecp) |
| int | RDB_init_table (RDB_object *tbp, const char *name, int attrc, const RDB_attr attrv[], int keyc, const RDB_string_vec keyv[], RDB_exec_context *ecp) |
| int | RDB_table_keys (RDB_object *tbp, RDB_exec_context *ecp, RDB_string_vec **keyvp) |
| const char * | RDB_table_name (const RDB_object *tbp) |
| int | RDB_copy_table (RDB_object *dstp, RDB_object *srcp, RDB_exec_context *ecp, RDB_transaction *txp) |
| int | RDB_extract_tuple (RDB_object *tbp, RDB_exec_context *ecp, RDB_transaction *txp, RDB_object *tplp) |
| RDB_bool | RDB_table_is_persistent (const RDB_object *tbp) |
| RDB_bool | RDB_table_is_real (const RDB_object *tbp) |
| int | RDB_subset (RDB_object *tb1p, RDB_object *tb2p, RDB_exec_context *ecp, RDB_transaction *txp, RDB_bool *resultp) |
| RDB_bool | RDB_table_refers (const RDB_object *srctbp, const RDB_object *dsttbp) |
| RDB_attr * | RDB_table_attrs (const RDB_object *tbp, int *attrcp) |
| RDB_object * | RDB_expr_to_vtable (RDB_expression *exp, RDB_exec_context *ecp, RDB_transaction *txp) |
| RDB_expression * | RDB_vtable_expr (const RDB_object *tbp) |
| int RDB_add_table | ( | RDB_object * | tbp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_add_table adds the table specified by tbp to the database the transaction specified by txp interacts with.
If an error occurs, an error value is left in *ecp.
If the table is a local (transient) table, it is made global (persistent).
The table must have a name.
Currently, RDB_add_table is not supported for local real tables.
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.
| int RDB_all | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
RDB_all computes a logical AND over the attribute attrname of the table specified by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be of type BOOLEAN.
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.
| int RDB_any | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
RDB_any computes a logical OR over the attribute attrname of the table specified by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be of type BOOLEAN.
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.
| int RDB_avg | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_float * | resultp | ||
| ) |
RDB_avg computes the average over the attribute attrname of the table specified by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be numeric.
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.
| RDB_int RDB_cardinality | ( | RDB_object * | tbp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_cardinality returns the number of tuples in the table pointed to by tbp.
If an error occurs, an error value is left in *ecp.
On success, the number of tuples is returned. On failure, (RDB_int)RDB_ERROR is returned. (RDB_int)RDB_ERROR is guaranteed to be lower than zero.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| int RDB_copy_table | ( | RDB_object * | dstp, |
| RDB_object * | srcp, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_copy_table assigns the table specified by srcp to the value of the table specified by dstp. The two tables must have the same heading.
Currently, virtual target tables are not supported.
If an error occurs, an error value is left in *ecp.
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.
| RDB_object* RDB_create_table | ( | const char * | name, |
| int | attrc, | ||
| const RDB_attr | attrv[], | ||
| int | keyc, | ||
| const RDB_string_vec | keyv[], | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_create_table creates a persistent table with name name in the database the transaction *txp interacts with and returns a pointer to the newly created RDB_object structure which represents the table.
If an error occurs, an error value is left in *ecp.
The table will have attrc attributes. The individual attributes are specified by the elements of attrv. options is currently ignored, but should be set to zero for compatibility with future versions.
The candidate keys for the table are specified by keyc and keyv.
A candidate key must not be a subset of another. If a single candidate key is specified, that key may be empty (not contain any attributes).
The database *txp interacts with must be a user database.
Passing a keyv of NULL is equivalent to specifiying a single key which consists of all attributes, that is, the table will be all-key.
To enforce the key constraints, DuroDBMS creates a unique hash index for each key.
On success, a pointer to the newly created table is returned. If an error occurred, NULL is returned.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| RDB_object* RDB_create_table_from_type | ( | const char * | name, |
| RDB_type * | reltyp, | ||
| int | keyc, | ||
| const RDB_string_vec | keyv[], | ||
| int | default_attrc, | ||
| const RDB_attr | default_attrv[], | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_create_table_from_type acts like RDB_create_table(), except that it takes a RDB_type argument instead of attribute arguments.
reltyp must be a relation type and will be managed by the table created.
If default_attrc is greater than zero, default_attrv must point to an array of length default_attrc where name is the attribute name and defaultp points to the default value for that attribute. Entries with a defaultp of NULL are ignored. Other fields of RDB_attr are ignored, but options should be set to zero for compatibility with future versions.
| int RDB_drop_table | ( | RDB_object * | tbp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_drop_table deletes the table specified by tbp and releases all resources associated with that table. If the table is virtual, its unnamed child tables are also deleted.
If an error occurs, an error value is left in *ecp.
If the table is local, txp may be NULL.
On success, RDB_OK is returned. On failure, RDB_ERROR is returned.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| RDB_object* RDB_expr_to_vtable | ( | RDB_expression * | exp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_expr_to_vtable creates a virtual table from the expression *exp.
If an error occurs, an error value is left in *ecp.
A pointer to the newly created table, or NULL if an error occurred.
| int RDB_extract_tuple | ( | RDB_object * | tbp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_object * | tplp | ||
| ) |
RDB_extract_tuple extracts a single tuple from a table which contains only one tuple and stores its value in the variable pointed to by tplp.
If an error occurs, the tuple value of the variable pointed to by tplp is undefined and an error value is left in *ecp.
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.
| RDB_object* RDB_get_table | ( | const char * | name, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_get_table looks up the global table with name name in the environment of the database the transaction specified by txp interacts with and returns a pointer to it.
If an error occurs, an error value is left in *ecp.
A pointer to the table, or NULL if an error occurred.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| int RDB_init_table | ( | RDB_object * | tbp, |
| const char * | name, | ||
| int | attrc, | ||
| const RDB_attr | attrv[], | ||
| int | keyc, | ||
| const RDB_string_vec | keyv[], | ||
| RDB_exec_context * | ecp | ||
| ) |
Turn *tbp into a transient table. tbp should have been initialized using RDB_init_obj().
For name, attrc, attrv, keyc, keyv, and ecp, the same rules apply as for RDB_create_table().
RDB_OK on success, RDB_ERROR if an error occurred.
The call may also fail for a system error.
| int RDB_init_table_from_type | ( | RDB_object * | tbp, |
| const char * | name, | ||
| RDB_type * | reltyp, | ||
| int | keyc, | ||
| const RDB_string_vec | keyv[], | ||
| int | default_attrc, | ||
| const RDB_attr * | default_attrv, | ||
| RDB_exec_context * | ecp | ||
| ) |
Like RDB_init_table(), but uses a RDB_type argument instead of attribute arguments.
If default_attrc is greater than zero, default_attrv must point to an array of length default_attrc where name is the attribute name and defaultp points to the default value for that attribute. Entries with a defaultp of NULL are ignored. Other fields of RDB_attr are ignored, but options should be set to zero for compatibility with future versions.
If it returns with RDB_OK, rtyp is consumed.
| int RDB_max | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_object * | resultp | ||
| ) |
RDB_max computes the maximum over the attribute attrname of the table specified by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be numeric and the result is of the same type as the attribute.
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.
| int RDB_min | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_object * | resultp | ||
| ) |
RDB_min computes the minimum over the attribute attrname of the table specified by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be numeric and the result is of the same type as the attribute.
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.
| RDB_int RDB_move_tuples | ( | RDB_object * | dstp, |
| RDB_object * | srcp, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
Copy all tuples from source table into the destination table. The destination table must be a real table.
| int RDB_set_table_name | ( | RDB_object * | tbp, |
| const char * | name, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp | ||
| ) |
RDB_set_table_name sets the name of the table to name.
If an error occurs, an error value is left in *ecp.
On success, RDB_OK is returned. On failure, RDB_ERROR is returned.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| int RDB_subset | ( | RDB_object * | tb1p, |
| RDB_object * | tb2p, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
RDB_subset checks if the table specified by tb1p is a subset of the table specified by tb2p and stores the result at the location pointed to by resultp.
If an error occurs, an error value is left in *ecp.
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.
| int RDB_sum | ( | RDB_object * | tbp, |
| const char * | attrname, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_object * | resultp | ||
| ) |
RDB_sum computes the sum over the attribute attrname of the table pointed to by tbp and stores the result at the location pointed to by resultp.
If the table has only one attribute, attrname may be NULL.
If an error occurs, an error value is left in *ecp.
The attribute attrname must be numeric and the result is of the same type as the attribute.
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.
| RDB_attr* RDB_table_attrs | ( | const RDB_object * | tbp, |
| int * | attrcp | ||
| ) |
| int RDB_table_contains | ( | RDB_object * | tbp, |
| const RDB_object * | tplp, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
Check if the tuple *tplp is an element of the table *tbp and store the result at the location pointed to by resultp.
If an error occurs, an error value is left in *ecp.
On success, RDB_OK is returned. If an error occurred, RDB_ERROR is returned.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| int RDB_table_is_empty | ( | RDB_object * | tbp, |
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
RDB_table_is_empty checks if the table specified by tbp is empty and stores the result of the check at the location pointed to by resultp.
If an error occurs, an error value is left in *ecp.
RDB_OK on success, RDB_ERROR if an error occurred.
| RDB_bool RDB_table_is_persistent | ( | const RDB_object * | tbp | ) |
RDB_table_is_persistent returns if the table *tbp is persistent.
RDB_TRUE if *tbp is persistent, RDB_FALSE if it is transient.
| RDB_bool RDB_table_is_real | ( | const RDB_object * | tbp | ) |
RDB_table_is_real returns if the table *tbp is real.
RDB_TRUE if *tbp is real, RDB_FALSE if it is virtual.
| int RDB_table_matching_tuple | ( | RDB_object * | tbp, |
| const RDB_object * | tplp, | ||
| RDB_exec_context * | ecp, | ||
| RDB_transaction * | txp, | ||
| RDB_bool * | resultp | ||
| ) |
Check if *tbp contains a tuple that matches *tplp and store the result at *resultp.
If an error occurs, an error value is left in *ecp.
On success, RDB_OK is returned. If an error occurred, RDB_ERROR is returned.
The call may also fail for a system error, in which case the transaction may be implicitly rolled back.
| const char* RDB_table_name | ( | const RDB_object * | tbp | ) |
RDB_table_name returns a pointer to the name of a table.
A pointer to the name of the table, or NULL if the table has no name.
| RDB_bool RDB_table_refers | ( | const RDB_object * | srctbp, |
| const RDB_object * | dsttbp | ||
| ) |
Return TRUE if *srctbp depends on *dsttbp, FALSE otherwise.
| RDB_expression* RDB_vtable_expr | ( | const RDB_object * | tbp | ) |
If *tbp is a virtual table, return the defining expression, otherwise NULL.
1.7.6.1