diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-01-10 13:52:12 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-01-10 13:52:12 -0500 |
commit | f28cef19f4c0d556c28f302290650a59027b9168 (patch) | |
tree | 3f8c8cec0464a3832dbd8fffc3ee2cfe988ffcf7 /examples | |
parent | f2e343b02fce463879fb002f30468a4f029082f4 (diff) | |
download | mongo-f28cef19f4c0d556c28f302290650a59027b9168.tar.gz |
Add support for the WT_CURSOR.compare_equal method.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/ex_all.c | 13 | ||||
-rw-r--r-- | examples/java/com/wiredtiger/examples/ex_all.java | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 31ad812e6f6..6fe5296ea58 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -242,6 +242,19 @@ cursor_ops(WT_SESSION *session) } { + WT_CURSOR *other = NULL; + /*! [Cursor equality] */ + int equal; + ret = cursor->compare_equal(cursor, other, &equal); + if (equal == 0) { + /* Cursors reference the same key */ + } else { + /* Cursors don't reference the same key */ + } + /*! [Cursor equality] */ + } + + { /*! [Search for an exact match] */ const char *key = "some key"; cursor->set_key(cursor, key); diff --git a/examples/java/com/wiredtiger/examples/ex_all.java b/examples/java/com/wiredtiger/examples/ex_all.java index 4c30b893e06..5b1b0f58efa 100644 --- a/examples/java/com/wiredtiger/examples/ex_all.java +++ b/examples/java/com/wiredtiger/examples/ex_all.java @@ -215,6 +215,19 @@ public static int cursor_ops(Session session) } { + Cursor other = null; + /*! [Cursor equality] */ + int equal; + equal = cursor.compare_equal(other); + if (equal == 0) { + /* Cursors reference the same key */ + } else { + /* Cursors don't reference the same key */ + } + /*! [Cursor equality] */ + } + + { /*! [Search for an exact match] */ String key = "some key"; cursor.putKeyString(key); |