32 printf(
"%s() returned error %d: %s\n", foo, st,
ups_strerror(st));
37 main(
int argc,
char **argv) {
49 st =
ups_env_create(&env,
"ups://localhost:8080/env1.db", 0, 0, 0);
51 error(
"ups_env_create", st);
56 error(
"ups_env_open_db", st);
59 for (i = 0; i <
LOOP; i++) {
68 error(
"ups_db_insert", st);
72 for (i = 0; i <
LOOP; i++) {
78 error(
"ups_db_find", st);
81 if (*(
int *)record.
data != i) {
82 printf(
"ups_db_find() ok, but returned bad value\n");
88 for (i = 0; i <
LOOP; i++) {
94 error(
"ups_db_erase", st);
98 for (i = 0; i <
LOOP; i++) {
100 key.
size =
sizeof(i);
104 error(
"ups_db_find", st);
110 error(
"ups_db_close", st);
115 error(
"ups_env_close", st);
117 printf(
"success!\n");
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_erase(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, 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 ups_status_t UPS_CALLCONV ups_db_find(ups_db_t *db, ups_txn_t *txn, ups_key_t *key, ups_record_t *record, uint32_t flags)
void error(const char *foo, ups_status_t st)
int main(int argc, char **argv)
Include file for upscaledb embedded database.
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open_db(ups_env_t *env, ups_db_t **db, uint16_t name, uint32_t flags, const ups_parameter_t *params)
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)
#define UPS_KEY_NOT_FOUND
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_close(ups_db_t *db, uint32_t flags)
struct ups_env_t ups_env_t