Fix c_simple_example

main
Igor Canadi 10 years ago
parent 15d2abbec3
commit 402c1152a7
  1. 10
      examples/c_simple_example.c

@ -29,15 +29,17 @@ int main(int argc, char **argv) {
rocksdb_writeoptions_t *writeoptions = rocksdb_writeoptions_create();
const char key[] = "key";
const char *value = "value";
rocksdb_put(db, writeoptions, key, strlen (key), value, \
strlen (value) + 1, &err);
rocksdb_put(db, writeoptions, key, strlen(key), value, strlen(value) + 1,
&err);
assert(!err);
// Get value
rocksdb_readoptions_t *readoptions = rocksdb_readoptions_create();
size_t len;
value = rocksdb_get(db, readoptions, key, strlen (key), &len, &err);
char *returned_value =
rocksdb_get(db, readoptions, key, strlen(key), &len, &err);
assert(!err);
assert(strcmp(value, "value") == 0);
assert(strcmp(returned_value, "value") == 0);
free(returned_value);
// cleanup
rocksdb_writeoptions_destroy(writeoptions);

Loading…
Cancel
Save