Files
mongo/examples/c/ex_config.c
Michael Cahill b65420c0bd More work on documentation and examples, removed some things from the API, incorporated some of Keith's feedback.
--HG--
branch : mjc
rename : examples/c/ex_schema.c => examples/c/ex_call_center.c
extra : transplant_source : %AE%E9%C4%0B%3A%C5%0EH%E1%A8%A2L%E6%D2%D6%40G%9Dzq
2010-12-16 22:54:09 +11:00

45 lines
1019 B
C

/*
* ex_config.c Copyright (c) 2010 WiredTiger
*
* This is an example demostrating how to configure various database and table
* properties.
*/
#include <stdio.h>
#include <string.h>
#include <wiredtiger.h>
const char *home = "WT_TEST";
int main()
{
int ret;
WT_CONNECTION *conn;
WT_SESSION *session;
WT_CURSOR *cursor;
const char *key, *value;
if ((ret = wiredtiger_open(home, NULL,
"create,cache_size=10000000", &conn)) != 0 ||
(ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
fprintf(stderr, "Error connecting to %s: %s\n",
home, wiredtiger_strerror(ret));
/* Note: further error checking omitted for clarity. */
/* Open a cursor on the (virtual) configuration table. */
ret = session->open_cursor(session, "config:", NULL, &cursor);
while ((ret = cursor->next(cursor)) == 0) {
cursor->get_key(cursor, &key);
cursor->get_value(cursor, &value);
printf("Got configuration value: %s = %s\n", key, value);
}
ret = conn->close(conn, NULL);
return (ret);
}