upscaledb  2.1.13
Data Structures | Functions
upscaledb_uqi.h File Reference
#include <ups/upscaledb.h>

Go to the source code of this file.

Data Structures

struct  uqi_bool_predicate_t
 
struct  uqi_result_t
 

Functions

UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count (ups_db_t *db, ups_txn_t *txn, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_if (ups_db_t *db, ups_txn_t *txn, uqi_bool_predicate_t *pred, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_distinct (ups_db_t *db, ups_txn_t *txn, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_distinct_if (ups_db_t *db, ups_txn_t *txn, uqi_bool_predicate_t *pred, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_average (ups_db_t *db, ups_txn_t *txn, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_average_if (ups_db_t *db, ups_txn_t *txn, uqi_bool_predicate_t *pred, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_sum (ups_db_t *db, ups_txn_t *txn, uqi_result_t *result)
 
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_sum_if (ups_db_t *db, ups_txn_t *txn, uqi_bool_predicate_t *pred, uqi_result_t *result)
 

Function Documentation

UPS_EXPORT ups_status_t UPS_CALLCONV uqi_average ( ups_db_t db,
ups_txn_t txn,
uqi_result_t result 
)

Calculates the average of all keys.

This is a non-distinct function and includes all duplicate keys.

Internally, a 64bit counter is used for the calculation. This function does not protect against an overflow of this counter.

The keys in the database (db) have to be numeric, which means that the Database's type must be one of UPS_TYPE_UINT8, UPS_TYPE_UINT16, UPS_TYPE_UINT32, UPS_TYPE_UINT64, UPS_TYPE_REAL32 or UPS_TYPE_REAL64.

The actual result is returned in result->u.result_u64 or result->u.result_double, depending on the Database's configuration.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_INV_PARAMETER if the database is not numeric
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_average_if ( ups_db_t db,
ups_txn_t txn,
uqi_bool_predicate_t pred,
uqi_result_t result 
)

Calculates the average of all keys where a predicate applies.

This is a non-distinct function and includes all duplicate keys for which the predicate function returns true.

Internally, a 64bit counter is used for the calculation. This function does not protect against an overflow of this counter.

The keys in the database (db) have to be numeric, which means that the Database's type must be one of UPS_TYPE_UINT8, UPS_TYPE_UINT16, UPS_TYPE_UINT32, UPS_TYPE_UINT64, UPS_TYPE_REAL32 or UPS_TYPE_REAL64.

The actual result is returned in result->u.result_u64 or result->u.result_double, depending on the Database's configuration.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_INV_PARAMETER if the database is not numeric
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count ( ups_db_t db,
ups_txn_t txn,
uqi_result_t result 
)

Counts the keys in a Database

This is a non-distinct count. If the Database has duplicate keys then they are included in the count.

The actual count is returned in result->u.result_u64. result->type is set to UPS_TYPE_U64.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_distinct ( ups_db_t db,
ups_txn_t txn,
uqi_result_t result 
)

Counts the distinct keys in a Database

This is a distinct count. If the Database has duplicate keys then they are not included in the count.

The actual count is returned in result->u.result_u64. result->type is set to UPS_TYPE_U64.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_distinct_if ( ups_db_t db,
ups_txn_t txn,
uqi_bool_predicate_t pred,
uqi_result_t result 
)

Selectively counts the distinct keys in a Database

This is a distinct count. If the Database has duplicate keys then they are not included in the count. The predicate function is applied to each key. If it returns true then the key is included in the count; otherwise the key is ignored.

The actual count is returned in result->u.result_u64. result->type is set to UPS_TYPE_U64.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_count_if ( ups_db_t db,
ups_txn_t txn,
uqi_bool_predicate_t pred,
uqi_result_t result 
)

Selectively counts the keys in a Database

This is a non-distinct count. If the Database has duplicate keys then they are included in the count. The predicate function is applied to each key. If it returns true then the key (and its duplicates) is included in the count; otherwise the key is ignored.

The actual count is returned in result->u.result_u64. result->type is set to UPS_TYPE_U64.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_sum ( ups_db_t db,
ups_txn_t txn,
uqi_result_t result 
)

Calculates the sum of all keys.

This is a non-distinct function and includes all duplicate keys.

Internally, a 64bit counter is used for the calculation. This function does not protect against an overflow of this counter.

The keys in the database (db) have to be numeric, which means that the Database's type must be one of UPS_TYPE_UINT8, UPS_TYPE_UINT16, UPS_TYPE_UINT32, UPS_TYPE_UINT64, UPS_TYPE_REAL32 or UPS_TYPE_REAL64.

The actual result is returned in result->u.result_u64 or result->u.result_double, depending on the Database's configuration.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_INV_PARAMETER if the database is not numeric
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_sum_if ( ups_db_t db,
ups_txn_t txn,
uqi_bool_predicate_t pred,
uqi_result_t result 
)

Calculates the sum of all keys where a predicate applies.

This is a non-distinct function and includes all duplicate keys for which the predicate function returns true.

Internally, a 64bit counter is used for the calculation. This function does not protect against an overflow of this counter.

The keys in the database (db) have to be numeric, which means that the Database's type must be one of UPS_TYPE_UINT8, UPS_TYPE_UINT16, UPS_TYPE_UINT32, UPS_TYPE_UINT64, UPS_TYPE_REAL32 or UPS_TYPE_REAL64.

The actual result is returned in result->u.result_u64 or result->u.result_double, depending on the Database's configuration.

Returns
UPS_SUCCESS upon success
UPS_INV_PARAMETER if one of the parameters is NULL
UPS_INV_PARAMETER if the database is not numeric