summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2015-01-14 02:28:10 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2015-01-14 02:28:10 +1100
commit812be6c438ef11d2edde8211370601e350963a43 (patch)
tree7f589af6462ce97832aa4dd03bf74e61f3760f16 /lang
parent56865ca8ec3cb43e15c05cea9b7ef704302fe694 (diff)
downloadmongo-812be6c438ef11d2edde8211370601e350963a43.tar.gz
Rename WT_CURSOR compare_equal to be equals.
While here, add a generic cursor equals stub in curstd, rather than redirecting via cursor function pointer lists. Implement the Java API wrapper.
Diffstat (limited to 'lang')
-rw-r--r--lang/java/java_doc.i2
-rw-r--r--lang/java/wiredtiger.i19
-rw-r--r--lang/python/wiredtiger.i12
3 files changed, 26 insertions, 7 deletions
diff --git a/lang/java/java_doc.i b/lang/java/java_doc.i
index 1de01b0528e..0890b14fa65 100644
--- a/lang/java/java_doc.i
+++ b/lang/java/java_doc.i
@@ -5,7 +5,7 @@ COPYDOC(__wt_cursor, WT_CURSOR, get_value)
COPYDOC(__wt_cursor, WT_CURSOR, set_key)
COPYDOC(__wt_cursor, WT_CURSOR, set_value)
COPYDOC(__wt_cursor, WT_CURSOR, compare)
-COPYDOC(__wt_cursor, WT_CURSOR, compare_equal)
+COPYDOC(__wt_cursor, WT_CURSOR, equals)
COPYDOC(__wt_cursor, WT_CURSOR, next)
COPYDOC(__wt_cursor, WT_CURSOR, prev)
COPYDOC(__wt_cursor, WT_CURSOR, reset)
diff --git a/lang/java/wiredtiger.i b/lang/java/wiredtiger.i
index a922a7a6b2e..19569aecf1d 100644
--- a/lang/java/wiredtiger.i
+++ b/lang/java/wiredtiger.i
@@ -293,6 +293,8 @@ WT_CLASS(struct __wt_async_op, WT_ASYNC_OP, op)
%ignore __wt_cursor::compare(WT_CURSOR *, WT_CURSOR *, int *);
%rename (compare_wrap) __wt_cursor::compare;
+%ignore __wt_cursor::equals(WT_CURSOR *, WT_CURSOR *, int *);
+%rename (equals_wrap) __wt_cursor::equals;
%rename (AsyncOpType) WT_ASYNC_OPTYPE;
%rename (getKeyFormat) __wt_async_op::getKey_format;
%rename (getValueFormat) __wt_async_op::getValue_format;
@@ -1088,6 +1090,13 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
return cmp;
}
+ int equals_wrap(JNIEnv *jenv, WT_CURSOR *other) {
+ int cmp, ret = $self->equals($self, other, &cmp);
+ if (ret != 0)
+ throwWiredTigerException(jenv, ret);
+ return cmp;
+ }
+
%javamethodmodifiers java_init "protected";
int java_init(jobject jcursor) {
JAVA_CALLBACK *jcb = (JAVA_CALLBACK *)$self->lang_private;
@@ -1532,6 +1541,16 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler};
}
/**
+ * Compare this cursor's position to another Cursor.
+ *
+ * \return The result of the comparison.
+ */
+ public int equals(Cursor other)
+ throws WiredTigerException {
+ return equals_wrap(other);
+ }
+
+ /**
* Retrieve the next item in the table.
*
* \return The result of the comparison.
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i
index f4a2801ed4c..1a23bd5ea5e 100644
--- a/lang/python/wiredtiger.i
+++ b/lang/python/wiredtiger.i
@@ -381,7 +381,7 @@ NOTFOUND_OK(__wt_cursor::search)
NOTFOUND_OK(__wt_cursor::update)
COMPARE_OK(__wt_cursor::compare)
-COMPARE_OK(__wt_cursor::compare_equal)
+COMPARE_OK(__wt_cursor::equals)
COMPARE_OK(__wt_cursor::search_near)
/* Lastly, some methods need no (additional) error checking. */
@@ -416,7 +416,7 @@ COMPARE_OK(__wt_cursor::search_near)
/* Next, override methods that return integers via arguments. */
%ignore __wt_cursor::compare(WT_CURSOR *, WT_CURSOR *, int *);
-%ignore __wt_cursor::compare_equal(WT_CURSOR *, WT_CURSOR *, int *);
+%ignore __wt_cursor::equals(WT_CURSOR *, WT_CURSOR *, int *);
%ignore __wt_cursor::search_near(WT_CURSOR *, int *);
/* SWIG magic to turn Python byte strings into data / size. */
@@ -699,19 +699,19 @@ typedef int int_void;
return (ret);
}
- /* compare_equal: special handling. */
- int compare_equal(WT_CURSOR *other) {
+ /* equals: special handling. */
+ int equals(WT_CURSOR *other) {
int cmp = 0;
int ret = 0;
if (other == NULL) {
SWIG_Error(SWIG_NullReferenceError,
- "in method 'Cursor_compare_equal', "
+ "in method 'Cursor_equals', "
"argument 1 of type 'struct __wt_cursor *' "
"is None");
ret = EINVAL; /* any non-zero value will do. */
}
else {
- ret = $self->compare_equal($self, other, &cmp);
+ ret = $self->equals($self, other, &cmp);
/*
* Compare-equal is documented to return 0 and !0, map