summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-03-17 10:08:37 -0400
committerKeith Bostic <keith@wiredtiger.com>2013-03-17 10:08:37 -0400
commit9bea2a1b57bf724f5277a80f45c3067976be0e74 (patch)
tree78f4817540925ddaaa337a5faaa4ac3e6aa9ed59
parent296bc035de368c49bcb907ca5023dcf67eae3cdd (diff)
downloadmongo-9bea2a1b57bf724f5277a80f45c3067976be0e74.tar.gz
Create/drop the table we're manipulating, otherwise we don't get config
checking on the configuration strings.
-rw-r--r--examples/c/ex_all.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
index 00f34c39beb..e3a71ddb978 100644
--- a/examples/c/ex_all.c
+++ b/examples/c/ex_all.c
@@ -447,11 +447,13 @@ session_ops(WT_SESSION *session)
ret = session->create(session,
"table:mytable", "key_format=S,value_format=S");
/*! [Create a table] */
+ ret = session->drop(session, "table:mytable", NULL);
/*! [Create a column-store table] */
ret = session->create(session,
"table:mytable", "key_format=r,value_format=S");
/*! [Create a column-store table] */
+ ret = session->drop(session, "table:mytable", NULL);
/*! [Create a table with columns] */
/*
@@ -462,6 +464,7 @@ session_ops(WT_SESSION *session)
"key_format=r,value_format=SiH,"
"columns=(id,department,salary,year-started)");
/*! [Create a table with columns] */
+ ret = session->drop(session, "table:mytable", NULL);
/*
* This example code gets run, and the compression libraries might not
@@ -474,51 +477,64 @@ session_ops(WT_SESSION *session)
"table:mytable",
"block_compressor=bzip2,key_format=S,value_format=S");
/*! [Create a bzip2 compressed table] */
+ ret = session->drop(session, "table:mytable", NULL);
/*! [Create a snappy compressed table] */
ret = session->create(session,
"table:mytable",
"block_compressor=snappy,key_format=S,value_format=S");
/*! [Create a snappy compressed table] */
+ ret = session->drop(session, "table:mytable", NULL);
#endif
/*! [Configure checksums to uncompressed] */
ret = session->create(session, "table:mytable",
"key_format=S,value_format=S,checksum=uncompressed");
/*! [Configure checksums to uncompressed] */
+ ret = session->drop(session, "table:mytable", NULL);
/*! [Configure dictionary compression on] */
ret = session->create(session, "table:mytable",
"key_format=S,value_format=S,dictionary=1000");
/*! [Configure dictionary compression on] */
+ ret = session->drop(session, "table:mytable", NULL);
/*! [Configure key prefix compression off] */
ret = session->create(session, "table:mytable",
"key_format=S,value_format=S,prefix_compression=false");
/*! [Configure key prefix compression off] */
+ ret = session->drop(session, "table:mytable", NULL);
+#ifdef MIGHT_NOT_RUN
+ /* Requires sync_file_range */
/*! [os_cache_dirty_max configuration] */
ret = session->create(
session, "table:mytable", "os_cache_dirty_max=500MB");
/*! [os_cache_dirty_max configuration] */
+ ret = session->drop(session, "table:mytable", NULL);
+ /* Requires posix_fadvise */
/*! [os_cache_max configuration] */
ret = session->create(session, "table:mytable", "os_cache_max=1GB");
/*! [os_cache_max configuration] */
+ ret = session->drop(session, "table:mytable", NULL);
+#endif
/*! [Create a cache-resident object] */
ret = session->create(session,
"table:mytable", "key_format=r,value_format=S,cache_resident=true");
/*! [Create a cache-resident object] */
+ ret = session->drop(session, "table:mytable", NULL);
+
+ {
+ /* Create a table for the session operations. */
+ ret = session->create(
+ session, "table:mytable", "key_format=S,value_format=S");
/*! [Compact a table] */
ret = session->compact(session, "table:mytable", NULL);
/*! [Compact a table] */
- /*! [Drop a table] */
- ret = session->drop(session, "table:mytable", NULL);
- /*! [Drop a table] */
-
/*! [Print to the message stream] */
ret = session->msg_printf(
session, "process ID %" PRIuMAX, (uintmax_t)getpid());
@@ -537,9 +553,6 @@ session_ops(WT_SESSION *session)
/*! [Truncate a table] */
{
- ret = session->create(
- session, "table:mytable", "key_format=S,value_format=S");
-
/*! [Truncate a range] */
WT_CURSOR *start, *stop;
@@ -565,6 +578,11 @@ session_ops(WT_SESSION *session)
ret = session->verify(session, "table:mytable", NULL);
/*! [Verify a table] */
+ /*! [Drop a table] */
+ ret = session->drop(session, "table:mytable", NULL);
+ /*! [Drop a table] */
+ }
+
/*! [Close a session] */
ret = session->close(session, NULL);
/*! [Close a session] */