31 printf(
"%s() returned error %d: %s\n", foo, st,
ups_strerror(st));
37 printf(
"usage: ./db2 <environment> <source-db> <destination-db>\n");
48 memset(&key, 0,
sizeof(key));
49 memset(&rec, 0,
sizeof(rec));
54 error(
"ups_cursor_create", st);
59 printf(
"database is empty!\n");
63 error(
"ups_cursor_move", st);
69 error(
"ups_db_insert", st);
78 error(
"ups_cursor_move", st);
87 main(
int argc,
char **argv) {
94 const char *env_path = 0;
100 src_name = atoi(argv[2]);
101 dest_name = atoi(argv[3]);
102 if (src_name == 0 || dest_name == 0)
108 error(
"ups_env_open", st);
113 error(
"ups_env_open_db", st);
119 error(
"ups_env_create_db", st);
127 error(
"ups_env_close", st);
129 printf(
"\nsuccess!\n");
int main(int argc, char **argv)
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)
void error(const char *foo, ups_status_t st)
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 ups_status_t UPS_CALLCONV ups_cursor_move(ups_cursor_t *cursor, ups_key_t *key, ups_record_t *record, uint32_t flags)
Include file for upscaledb embedded database.
struct ups_cursor_t ups_cursor_t
UPS_EXPORT ups_status_t UPS_CALLCONV ups_cursor_close(ups_cursor_t *cursor)
#define UPS_ENABLE_DUPLICATE_KEYS
void copy_db(ups_db_t *source, ups_db_t *dest)
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_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_cursor_create(ups_cursor_t **cursor, ups_db_t *db, ups_txn_t *txn, uint32_t flags)
#define UPS_KEY_NOT_FOUND
struct ups_env_t ups_env_t