本文整理汇总了C++中WT_CURSOR::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ WT_CURSOR::equals方法的具体用法?C++ WT_CURSOR::equals怎么用?C++ WT_CURSOR::equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_CURSOR
的用法示例。
在下文中一共展示了WT_CURSOR::equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strlen
//.........这里部分代码省略.........
}
/*! [Return the next record] */
ret = cursor->next(cursor);
/*! [Return the next record] */
/*! [Return the previous record] */
ret = cursor->prev(cursor);
/*! [Return the previous record] */
/*! [Reset the cursor] */
ret = cursor->reset(cursor);
/*! [Reset the cursor] */
{
WT_CURSOR *other = NULL;
/*! [Cursor comparison] */
int compare;
ret = cursor->compare(cursor, other, &compare);
if (compare == 0) {
/* Cursors reference the same key */
} else if (compare < 0) {
/* Cursor key less than other key */
} else if (compare > 0) {
/* Cursor key greater than other key */
}
/*! [Cursor comparison] */
}
{
WT_CURSOR *other = NULL;
/*! [Cursor equality] */
int equal;
ret = cursor->equals(cursor, other, &equal);
if (equal) {
/* 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);
ret = cursor->search(cursor);
/*! [Search for an exact match] */
}
ret = cursor_search_near(cursor);
{
/*! [Insert a new record or overwrite an existing record] */
/* Insert a new record or overwrite an existing record. */
const char *key = "some key", *value = "some value";
ret = session->open_cursor(
session, "table:mytable", NULL, NULL, &cursor);
cursor->set_key(cursor, key);
cursor->set_value(cursor, value);
ret = cursor->insert(cursor);
/*! [Insert a new record or overwrite an existing record] */
}
{
/*! [Insert a new record and fail if the record exists] */
示例2: strlen
//.........这里部分代码省略.........
error_check(cursor->next(cursor));
/*! [Return the next record] */
/*! [Reset the cursor] */
error_check(cursor->reset(cursor));
/*! [Reset the cursor] */
/*! [Return the previous record] */
error_check(cursor->prev(cursor));
/*! [Return the previous record] */
{
WT_CURSOR *other = NULL;
error_check(
session->open_cursor(session, NULL, cursor, NULL, &other));
{
/*! [Cursor comparison] */
int compare;
error_check(cursor->compare(cursor, other, &compare));
if (compare == 0) {
/* Cursors reference the same key */
} else if (compare < 0) {
/* Cursor key less than other key */
} else if (compare > 0) {
/* Cursor key greater than other key */
}
/*! [Cursor comparison] */
}
{
/*! [Cursor equality] */
int equal;
error_check(cursor->equals(cursor, other, &equal));
if (equal) {
/* Cursors reference the same key */
}
/*! [Cursor equality] */
}
}
{
/*! [Insert a new record or overwrite an existing record] */
/* Insert a new record or overwrite an existing record. */
const char *key = "some key", *value = "some value";
error_check(session->open_cursor(
session, "table:mytable", NULL, NULL, &cursor));
cursor->set_key(cursor, key);
cursor->set_value(cursor, value);
error_check(cursor->insert(cursor));
/*! [Insert a new record or overwrite an existing record] */
}
{
/*! [Search for an exact match] */
const char *key = "some key";
cursor->set_key(cursor, key);
error_check(cursor->search(cursor));
/*! [Search for an exact match] */
}
cursor_search_near(cursor);
{
/*! [Insert a new record and fail if the record exists] */
/* Insert a new record and fail if the record exists. */