diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-01-08 11:55:11 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2013-01-08 11:55:11 +1100 |
commit | c64d9fc9d26bc473980791b1452e255f06cfd09c (patch) | |
tree | 9d555afcb6f4f885a31022d0aa41e1e038f81511 | |
parent | e76e919a1c9a58571d2de8b16ff1dc0748e369a1 (diff) | |
download | mongo-c64d9fc9d26bc473980791b1452e255f06cfd09c.tar.gz |
Use the "overwrite" flag to WT_SESSION::open_cursor rather than wiredtiger_open "create" flag to demonstrate boolean value syntax: opening multiple connections isn't permitted.
-rw-r--r-- | examples/c/ex_all.c | 25 | ||||
-rw-r--r-- | src/docs/config-strings.dox | 9 |
2 files changed, 16 insertions, 18 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index a8829f9508f..d8575ec9137 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -93,7 +93,7 @@ cursor_ops(WT_SESSION *session) /* Reconfigure the cursor to overwrite the record. */ ret = session->open_cursor( - session, NULL, cursor, "overwrite=true", &overwrite_cursor); + session, NULL, cursor, "overwrite", &overwrite_cursor); ret = cursor->close(cursor); overwrite_cursor->set_value(overwrite_cursor, value); @@ -102,6 +102,17 @@ cursor_ops(WT_SESSION *session) } { + /*! [boolean configuration string example] */ + ret = session->open_cursor(session, "table:mytable", NULL, + "overwrite", &cursor); + ret = session->open_cursor(session, "table:mytable", NULL, + "overwrite=true", &cursor); + ret = session->open_cursor(session, "table:mytable", NULL, + "overwrite=1", &cursor); + /*! [boolean configuration string example] */ + } + + { /*! [Get the cursor's string key] */ const char *key; /* Get the cursor's string key. */ ret = cursor->get_key(cursor, &key); @@ -962,18 +973,6 @@ main(void) /*! [Open a connection] */ } - { - WT_CONNECTION *conn; - /*! [boolean configuration string example] */ - ret = wiredtiger_open( - "WiredTigerHome", NULL, "create,cache_size=500M", &conn); - ret = wiredtiger_open( - "WiredTigerHome", NULL, "create=true,cache_size=500M", &conn); - ret = wiredtiger_open( - "WiredTigerHome", NULL, "create=1,cache_size=500M", &conn); - /*! [boolean configuration string example] */ - } - /* * This example code gets run, and the compression libraries might not * be installed, causing the open to fail. The documentation requires diff --git a/src/docs/config-strings.dox b/src/docs/config-strings.dox index 7dd508e2f30..382cd040b4f 100644 --- a/src/docs/config-strings.dox +++ b/src/docs/config-strings.dox @@ -28,11 +28,10 @@ columns in a table, values are nested using parentheses. For example: @snippet ex_all.c Create a table with columns -Values of type of "boolean" can be set to any of \c false, \c true, -\c 0 or \c 1. If no value is specified for a value of type integer, a -default value of 1 is assumed; If no value is specified for a value of -type boolean, a default value of true is assumed. For example, all of -the following forms of the \c create configuration string are identical: +Values of type of "boolean" can be set to any of \c false, \c true, \c 0 +or \c 1. If no value is specified for a key, the value \c 1 is implied. +For example, all of the following forms of the \c overwrite +configuration string are identical: @snippet ex_all.c boolean configuration string example |