quasardb C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Double-precision floating point numbers

Functions

QDB_API_LINKAGE qdb_error_t qdb_double_put (qdb_handle_t handle, const char *alias, double value, qdb_time_t expiry_time)
 Creates a new double-precision floating point number. More...
 
QDB_API_LINKAGE qdb_error_t qdb_double_update (qdb_handle_t handle, const char *alias, double value, qdb_time_t expiry_time)
 Creates or updates a double-precision floating point number. More...
 
QDB_API_LINKAGE qdb_error_t qdb_double_get (qdb_handle_t handle, const char *alias, double *value)
 Retrieves the value of a double-precision floating point number. More...
 
QDB_API_LINKAGE qdb_error_t qdb_double_add (qdb_handle_t handle, const char *alias, double addend, double *result)
 Atomically increases or decreases a double-precision floating point number. More...
 

Detailed Description

Function Documentation

QDB_API_LINKAGE qdb_error_t qdb_double_add ( qdb_handle_t  handle,
const char *  alias,
double  addend,
double *  result 
)

Atomically increases or decreases a double-precision floating point number.

The specified entry will be atomically increased (or decreased) according to the given addend value:

  • To increase the value, specify a positive addend
  • To decrease the value, specify a negative addend

The function return the result of the operation.

The entry must already exist. If the entry is not a double, the function will return qdb_e_incompatible_type.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
addendThe value to add to the existing value.
resultA pointer to a double that will receive the current value of the entry, if successful.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_double_put, qdb_double_update, qdb_double_get
QDB_API_LINKAGE qdb_error_t qdb_double_get ( qdb_handle_t  handle,
const char *  alias,
double *  value 
)

Retrieves the value of a double-precision floating point number.

Atomically retrieves the value of an existing double-precision floating point number.

If the entry is not a double, the function will return qdb_e_incompatible_type.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueA pointer to a number that will receive the current value of the entry, if successful.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_double_put, qdb_double_update, qdb_double_add
QDB_API_LINKAGE qdb_error_t qdb_double_put ( qdb_handle_t  handle,
const char *  alias,
double  value,
qdb_time_t  expiry_time 
)

Creates a new double-precision floating point number.

Atomically creates an entry of the given alias and sets it to a cross-platform double-precision floating point number. If the entry already exists, the function returns an error.

You can specify an expiry or use qdb_never_expires if you don't want the entry to expire.

If you want to create or update an entry use qdb_double_update.

The value will be correctly translated independently of the endianness of the client's platform.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueThe value to which the number must be set.
expiry_timeAn optional absolute expiry time expressed in UTC UNIX epoch.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_double_update, qdb_double_get, qdb_double_add
QDB_API_LINKAGE qdb_error_t qdb_double_update ( qdb_handle_t  handle,
const char *  alias,
double  value,
qdb_time_t  expiry_time 
)

Creates or updates a double-precision floating point number.

Atomically updates an entry of the given alias to the provided value. If the entry doesn't exist, it will be created. If the entry is not a double, the function will return qdb_e_incompatible_type.

You can specify an expiry time or use qdb_never_expires if you don't want the entry to expire.

Parameters
handleA valid handle previously initialized by qdb_open or qdb_open_tcp.
aliasA pointer to a null-terminated UTF-8 string representing the alias of the entry.
valueThe value to which the number must be set.
expiry_timeAn optional absolute expiry time expressed in UTC UNIX epoch.
Returns
A qdb_error_t code indicating success or failure.
See Also
qdb_double_put, qdb_double_get, qdb_double_add