29 #define DATABASE_NAME 1 34 printf(
"%s() returned error %d: %s\n", foo, st,
ups_strerror(st));
39 main(
int argc,
char **argv)
53 error(
"ups_env_create", st);
60 error(
"ups_env_create_db", st);
66 for (
int i = 0; i < 10000; i++) {
73 error(
"ups_db_insert", st);
81 st =
uqi_select(env,
"MAX($record) FROM DATABASE 1", &result);
83 error(
"uqi_select", st);
86 printf(
"MAX($record): key %2u, record %u\n",
91 st =
uqi_select(env,
"MIN($record) FROM DATABASE 1", &result);
93 error(
"uqi_select", st);
96 printf(
"MIN($record): key %2u, record %u\n",
101 st =
uqi_select(env,
"AVERAGE($record) FROM DATABASE 1", &result);
103 error(
"uqi_select", st);
105 printf(
"AVERAGE($record): %f\n", *(
double *)record.
data);
112 error(
"ups_env_close", st);
114 printf(
"success!\n");
#define ups_make_record(PTR, SIZE)
void error(const char *foo, ups_status_t st)
UPS_EXPORT const char *UPS_CALLCONV ups_strerror(ups_status_t status)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_close(ups_env_t *env, uint32_t flags)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_insert(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
UPS_EXPORT void UPS_CALLCONV uqi_result_get_key(uqi_result_t *result, uint32_t row, ups_key_t *key)
Include file for upscaledb Query Interface.
UPS_EXPORT ups_status_t UPS_CALLCONV uqi_select(ups_env_t *env, const char *query, uqi_result_t **result)
UPS_EXPORT void UPS_CALLCONV uqi_result_get_record(uqi_result_t *result, uint32_t row, ups_record_t *record)
#define UPS_PARAM_RECORD_TYPE
UPS_EXPORT void UPS_CALLCONV uqi_result_close(uqi_result_t *result)
Include file for upscaledb embedded database.
int main(int argc, char **argv)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create(ups_env_t **env, const char *filename, uint32_t flags, uint32_t mode, const ups_parameter_t *param)
struct uqi_result_t uqi_result_t
#define UPS_RECORD_NUMBER32
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_create_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
#define UPS_PARAM_KEY_TYPE
struct ups_env_t ups_env_t