29 #define DATABASE_NAME 1 33 printf(
"%s() returned error %d: %s\n", foo, st,
ups_strerror(st));
38 main(
int argc,
char **argv) {
54 error(
"ups_env_create", st);
60 error(
"ups_env_create_db", st);
68 for (i = 0; i <
LOOP; i++) {
77 error(
"ups_db_insert", st);
87 for (i = 0; i <
LOOP; i++) {
93 error(
"ups_db_find", st);
98 if (*(
int *)record.
data != i) {
99 printf(
"ups_db_find() ok, but returned bad value\n");
110 error(
"ups_db_close", st);
113 error(
"ups_env_close", st);
117 error(
"ups_env_open", st);
120 error(
"ups_env_open_db", st);
123 for (i = 0; i <
LOOP; i++) {
124 key.
size =
sizeof(i);
129 error(
"ups_db_erase", st);
136 for (i = 0; i <
LOOP; i++) {
137 key.
size =
sizeof(i);
142 error(
"ups_db_find", st);
149 error(
"ups_env_close", st);
151 printf(
"success!\n");
UPS_EXPORT ups_status_t UPS_CALLCONV ups_env_open(ups_env_t **env, const char *filename, uint32_t flags, const ups_parameter_t *param)
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)
int main(int argc, char **argv)
Include file for upscaledb embedded database.
#define UPS_PARAM_RECORD_SIZE
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)
void error(const char *foo, ups_status_t st)
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
#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