27 #define DATABASE_NAME 1 32 int s = strncmp((
const char *)lhs, (
const char *)rhs,
33 lhs_length < rhs_length ? lhs_length : rhs_length);
42 main(
int argc,
char **argv) {
56 printf(
"This sample uses upscaledb to sort data.\n");
57 printf(
"Reading from stdin...\n");
64 printf(
"ups_env_create() failed with error %d\n", st);
75 printf(
"ups_env_create_db() failed with error %d\n", st);
85 printf(
"ups_set_compare_func() failed with error %d\n", st);
93 while (fgets(line,
sizeof(line), stdin)) {
94 char *start = line, *p;
100 while ((p = strtok(start,
" \t\r\n"))) {
107 printf(
"ups_db_insert() failed with error %d\n", st);
119 printf(
"ups_cursor_create() failed with error %d\n", st);
131 printf(
"ups_cursor_next() failed with error %d\n", st);
137 printf(
"%s\n", (
const char *)key.
data);
147 printf(
"ups_env_close() failed with error %d\n", 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.
#define UPS_DUPLICATE_KEY
#define UPS_PARAM_RECORD_SIZE
struct ups_cursor_t ups_cursor_t
#define UPS_ENABLE_DUPLICATE_KEYS
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)
UPS_EXPORT ups_status_t UPS_CALLCONV ups_db_set_compare_func(ups_db_t *db, ups_compare_func_t foo)
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
static int my_string_compare(ups_db_t *db, const uint8_t *lhs, uint32_t lhs_length, const uint8_t *rhs, uint32_t rhs_length)
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