本文整理汇总了C++中API_END_RET函数的典型用法代码示例。如果您正苦于以下问题:C++ API_END_RET函数的具体用法?C++ API_END_RET怎么用?C++ API_END_RET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了API_END_RET函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: __curmetadata_update
/*
* __curmetadata_update --
* WT_CURSOR->update method for the metadata cursor type.
*/
static int
__curmetadata_update(WT_CURSOR *cursor)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
update, ((WT_CURSOR_BTREE *)file_cursor)->btree);
WT_MD_CURSOR_NEEDKEY(cursor);
WT_MD_CURSOR_NEEDVALUE(cursor);
/*
* Since the key/value formats are 's' the WT_ITEMs must contain a
* NULL terminated string.
*/
ret =
__wt_metadata_update(session, cursor->key.data, cursor->value.data);
err: API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:29,代码来源:cur_metadata.c
示例2: __curds_close
/*
* __curds_close --
* WT_CURSOR.close method for the data-source cursor type.
*/
static int
__curds_close(WT_CURSOR *cursor)
{
WT_CURSOR_DATA_SOURCE *cds;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cds = (WT_CURSOR_DATA_SOURCE *)cursor;
CURSOR_API_CALL(cursor, session, close, NULL);
if (cds->source != NULL)
ret = cds->source->close(cds->source);
if (cds->collator_owned) {
if (cds->collator->terminate != NULL)
WT_TRET(cds->collator->terminate(
cds->collator, &session->iface));
cds->collator_owned = 0;
}
cds->collator = NULL;
/*
* The key/value formats are in allocated memory, which isn't standard
* behavior.
*/
__wt_free(session, cursor->key_format);
__wt_free(session, cursor->value_format);
WT_TRET(__wt_cursor_close(cursor));
err: API_END_RET(session, ret);
}
开发者ID:adityavs,项目名称:wiredtiger,代码行数:37,代码来源:cur_ds.c
示例3: __curmetadata_prev
/*
* __curmetadata_prev --
* WT_CURSOR->prev method for the metadata cursor type.
*/
static int
__curmetadata_prev(WT_CURSOR *cursor)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
prev, ((WT_CURSOR_BTREE *)file_cursor)->btree);
if (F_ISSET(mdc, WT_MDC_ONMETADATA)) {
ret = WT_NOTFOUND;
goto err;
}
ret = file_cursor->prev(file_cursor);
if (ret == 0) {
WT_MD_SET_KEY_VALUE(cursor, mdc, file_cursor);
} else if (ret == WT_NOTFOUND)
WT_ERR(__curmetadata_metadata_search(session, cursor));
err: if (ret != 0) {
F_CLR(mdc, WT_MDC_POSITIONED | WT_MDC_ONMETADATA);
F_CLR(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_VALUE_EXT);
}
API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:34,代码来源:cur_metadata.c
示例4: __curmetadata_search_near
/*
* __curmetadata_search_near --
* WT_CURSOR->search_near method for the metadata cursor type.
*/
static int
__curmetadata_search_near(WT_CURSOR *cursor, int *exact)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
search_near, ((WT_CURSOR_BTREE *)file_cursor)->btree);
WT_MD_CURSOR_NEEDKEY(cursor);
if (WT_KEY_IS_METADATA(&cursor->key)) {
WT_ERR(__curmetadata_metadata_search(session, cursor));
*exact = 1;
} else {
WT_ERR(file_cursor->search_near(file_cursor, exact));
WT_MD_SET_KEY_VALUE(cursor, mdc, file_cursor);
}
err: if (ret != 0) {
F_CLR(mdc, WT_MDC_POSITIONED | WT_MDC_ONMETADATA);
F_CLR(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_VALUE_EXT);
}
API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:33,代码来源:cur_metadata.c
示例5: __curjoin_extract_insert
/*
* __curjoin_extract_insert --
* Handle a key produced by a custom extractor.
*/
static int
__curjoin_extract_insert(WT_CURSOR *cursor)
{
WT_CURJOIN_EXTRACTOR *cextract;
WT_DECL_RET;
WT_ITEM ikey;
WT_SESSION_IMPL *session;
/*
* This insert method may be called multiple times during a single
* extraction. If we already have a definitive answer to the
* membership question, exit early.
*/
cextract = (WT_CURJOIN_EXTRACTOR *)cursor;
if (cextract->ismember)
return (0);
CURSOR_API_CALL(cursor, session, insert, NULL);
WT_ITEM_SET(ikey, cursor->key);
/*
* We appended a padding byte to the key to avoid rewriting the last
* column. Strip that away here.
*/
WT_ASSERT(session, ikey.size > 0);
--ikey.size;
ret = __curjoin_entry_in_range(session, cextract->entry, &ikey, false);
if (ret == WT_NOTFOUND)
ret = 0;
else if (ret == 0)
cextract->ismember = true;
err: API_END_RET(session, ret);
}
开发者ID:mongodb,项目名称:mongo,代码行数:39,代码来源:cur_join.c
示例6: __curlog_close
/*
* __curlog_close --
* WT_CURSOR.close method for the log cursor type.
*/
static int
__curlog_close(WT_CURSOR *cursor)
{
WT_CONNECTION_IMPL *conn;
WT_CURSOR_LOG *cl;
WT_DECL_RET;
WT_LOG *log;
WT_SESSION_IMPL *session;
CURSOR_API_CALL(cursor, session, close, NULL);
cl = (WT_CURSOR_LOG *)cursor;
conn = S2C(session);
WT_ASSERT(session, FLD_ISSET(conn->log_flags, WT_CONN_LOG_ENABLED));
log = conn->log;
WT_TRET(__wt_readunlock(session, log->log_archive_lock));
WT_TRET(__curlog_reset(cursor));
__wt_free(session, cl->cur_lsn);
__wt_free(session, cl->next_lsn);
__wt_scr_free(session, &cl->logrec);
__wt_scr_free(session, &cl->opkey);
__wt_scr_free(session, &cl->opvalue);
__wt_free(session, cl->packed_key);
__wt_free(session, cl->packed_value);
WT_TRET(__wt_cursor_close(cursor));
err: API_END_RET(session, ret);
}
开发者ID:brianleepzx,项目名称:mongo,代码行数:31,代码来源:cur_log.c
示例7: __curbackup_close
/*
* __curbackup_close --
* WT_CURSOR->close method for the backup cursor type.
*/
static int
__curbackup_close(WT_CURSOR *cursor)
{
WT_CURSOR_BACKUP *cb;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cb = (WT_CURSOR_BACKUP *)cursor;
CURSOR_API_CALL(cursor, session, close, NULL);
/*
* When starting a hot backup, we serialize hot backup cursors and set
* the connection's hot-backup flag. Once that's done, we set the
* cursor's backup-locker flag, implying the cursor owns all necessary
* cleanup (including removing temporary files), regardless of error or
* success. The cursor's backup-locker flag is never cleared (it's just
* discarded when the cursor is closed), because that cursor will never
* not be responsible for cleanup.
*/
if (F_ISSET(cb, WT_CURBACKUP_LOCKER))
WT_TRET(__backup_stop(session, cb));
WT_TRET(__wt_cursor_close(cursor));
session->bkp_cursor = NULL;
err: API_END_RET(session, ret);
}
开发者ID:DINKIN,项目名称:mongo,代码行数:32,代码来源:cur_backup.c
示例8: __curfile_close
/*
* __curfile_close --
* WT_CURSOR->close method for the btree cursor type.
*/
static int
__curfile_close(WT_CURSOR *cursor)
{
WT_CURSOR_BTREE *cbt;
WT_CURSOR_BULK *cbulk;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cbt = (WT_CURSOR_BTREE *)cursor;
CURSOR_API_CALL(cursor, session, close, cbt->btree);
if (F_ISSET(cursor, WT_CURSTD_BULK)) {
/* Free the bulk-specific resources. */
cbulk = (WT_CURSOR_BULK *)cbt;
WT_TRET(__wt_bulk_wrapup(session, cbulk));
__wt_buf_free(session, &cbulk->last);
}
WT_TRET(__wt_btcur_close(cbt, 0));
/* The URI is owned by the btree handle. */
cursor->internal_uri = NULL;
WT_TRET(__wt_cursor_close(cursor));
/*
* Note: release the data handle last so that cursor statistics are
* updated correctly.
*/
if (session->dhandle != NULL) {
/* Increment the data-source's in-use counter. */
__wt_cursor_dhandle_decr_use(session);
WT_TRET(__wt_session_release_btree(session));
}
err: API_END_RET(session, ret);
}
开发者ID:qihsh,项目名称:mongo,代码行数:38,代码来源:cur_file.c
示例9: __curfile_equals
/*
* __curfile_equals --
* WT_CURSOR->equals method for the btree cursor type.
*/
static int
__curfile_equals(WT_CURSOR *a, WT_CURSOR *b, int *equalp)
{
WT_CURSOR_BTREE *cbt;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cbt = (WT_CURSOR_BTREE *)a;
CURSOR_API_CALL(a, session, equals, cbt->btree);
/*
* Check both cursors are a "file:" type then call the underlying
* function, it can handle cursors pointing to different objects.
*/
if (!WT_PREFIX_MATCH(a->internal_uri, "file:") ||
!WT_PREFIX_MATCH(b->internal_uri, "file:"))
WT_ERR_MSG(session, EINVAL,
"Cursors must reference the same object");
WT_CURSOR_CHECKKEY(a);
WT_CURSOR_CHECKKEY(b);
ret = __wt_btcur_equals(
(WT_CURSOR_BTREE *)a, (WT_CURSOR_BTREE *)b, equalp);
err: API_END_RET(session, ret);
}
开发者ID:qihsh,项目名称:mongo,代码行数:31,代码来源:cur_file.c
示例10: __curbulk_insert_fix_bitmap
/*
* __curbulk_insert_fix_bitmap --
* Fixed-length column-store bulk cursor insert for bitmaps.
*/
static int
__curbulk_insert_fix_bitmap(WT_CURSOR *cursor)
{
WT_BTREE *btree;
WT_CURSOR_BULK *cbulk;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cbulk = (WT_CURSOR_BULK *)cursor;
btree = cbulk->cbt.btree;
/*
* Bulk cursor inserts are updates, but don't need auto-commit
* transactions because they are single-threaded and not visible
* until the bulk cursor is closed.
*/
CURSOR_API_CALL(cursor, session, insert, btree);
WT_STAT_FAST_DATA_INCR(session, cursor_insert_bulk);
WT_CURSOR_CHECKVALUE(cursor);
/* Insert the current record. */
ret = __wt_bulk_insert_fix_bitmap(session, cbulk);
err: API_END_RET(session, ret);
}
开发者ID:AshishSanju,项目名称:mongo,代码行数:30,代码来源:cur_bulk.c
示例11: __clsm_compare
/*
* __clsm_compare --
* WT_CURSOR->compare implementation for the LSM cursor type.
*/
static int
__clsm_compare(WT_CURSOR *a, WT_CURSOR *b, int *cmpp)
{
WT_CURSOR_LSM *alsm;
WT_DECL_RET;
WT_SESSION_IMPL *session;
/* There's no need to sync with the LSM tree, avoid WT_LSM_ENTER. */
alsm = (WT_CURSOR_LSM *)a;
CURSOR_API_CALL(a, session, compare, NULL);
/*
* Confirm both cursors refer to the same source and have keys, then
* compare the keys.
*/
if (strcmp(a->uri, b->uri) != 0)
WT_ERR_MSG(session, EINVAL,
"comparison method cursors must reference the same object");
WT_CURSOR_NEEDKEY(a);
WT_CURSOR_NEEDKEY(b);
WT_ERR(__wt_compare(
session, alsm->lsm_tree->collator, &a->key, &b->key, cmpp));
err: API_END_RET(session, ret);
}
开发者ID:nicopoliakov,项目名称:mongo,代码行数:31,代码来源:lsm_cursor.c
示例12: __curds_close
/*
* __curds_close --
* WT_CURSOR.close method for the data-source cursor type.
*/
static int
__curds_close(WT_CURSOR *cursor)
{
WT_CURSOR *source;
WT_DECL_RET;
WT_SESSION_IMPL *session;
source = ((WT_CURSOR_DATA_SOURCE *)cursor)->source;
CURSOR_API_CALL(cursor, session, close, NULL);
if (source != NULL)
ret = source->close(source);
/*
* The key/value formats are in allocated memory, which isn't standard
* behavior.
*/
__wt_free(session, cursor->key_format);
__wt_free(session, cursor->value_format);
WT_TRET(__wt_cursor_close(cursor));
err: API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:29,代码来源:cur_ds.c
示例13: __curjoin_get_value
/*
* __curjoin_get_value --
* WT_CURSOR->get_value for join cursors.
*/
static int
__curjoin_get_value(WT_CURSOR *cursor, ...)
{
WT_CURSOR_JOIN *cjoin;
WT_CURSOR_JOIN_ITER *iter;
WT_DECL_RET;
WT_SESSION_IMPL *session;
va_list ap;
cjoin = (WT_CURSOR_JOIN *)cursor;
iter = cjoin->iter;
va_start(ap, cursor);
CURSOR_API_CALL(cursor, session, get_value, NULL);
if (!F_ISSET(cjoin, WT_CURJOIN_INITIALIZED) ||
!__curjoin_entry_iter_ready(iter))
WT_ERR_MSG(session, EINVAL,
"join cursor must be advanced with next()");
if (iter->entry->index != NULL)
WT_ERR(__wt_curindex_get_valuev(iter->cursor, ap));
else
WT_ERR(__wt_curtable_get_valuev(iter->cursor, ap));
err: va_end(ap);
API_END_RET(session, ret);
}
开发者ID:Zhangwusheng,项目名称:wiredtiger,代码行数:31,代码来源:cur_join.c
示例14: __curmetadata_search
/*
* __curmetadata_search --
* WT_CURSOR->search method for the metadata cursor type.
*/
static int
__curmetadata_search(WT_CURSOR *cursor)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
search, ((WT_CURSOR_BTREE *)file_cursor)->btree);
WT_MD_CURSOR_NEEDKEY(cursor);
if (WT_KEY_IS_METADATA(&cursor->key))
WT_ERR(__curmetadata_metadata_search(session, cursor));
else {
WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_UNCOMMITTED,
ret = file_cursor->search(file_cursor));
WT_ERR(ret);
WT_ERR(__curmetadata_setkv(mdc, file_cursor));
}
err: if (ret != 0) {
F_CLR(mdc, WT_MDC_POSITIONED | WT_MDC_ONMETADATA);
F_CLR(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_VALUE_EXT);
}
API_END_RET(session, ret);
}
开发者ID:GYGit,项目名称:mongo,代码行数:34,代码来源:cur_metadata.c
示例15: __curindex_search_near
/*
* __curindex_search_near --
* WT_CURSOR->search_near method for index cursors.
*/
static int
__curindex_search_near(WT_CURSOR *cursor, int *exact)
{
WT_CURSOR *child;
WT_CURSOR_INDEX *cindex;
WT_DECL_RET;
WT_ITEM found_key;
WT_SESSION_IMPL *session;
int cmp;
cindex = (WT_CURSOR_INDEX *)cursor;
child = cindex->child;
JOINABLE_CURSOR_API_CALL(cursor, session, search, NULL);
/*
* We are searching using the application-specified key, which
* (usually) doesn't contain the primary key, so it is just a prefix of
* any matching index key. That said, if there is an exact match, we
* want to find the first matching index entry and set exact equal to
* zero.
*
* Do a search_near, and if we find an entry that is too small, step to
* the next one. In the unlikely event of a search past the end of the
* tree, go back to the last key.
*/
__wt_cursor_set_raw_key(child, &cursor->key);
WT_ERR(child->search_near(child, &cmp));
if (cmp < 0) {
if ((ret = child->next(child)) == WT_NOTFOUND)
ret = child->prev(child);
WT_ERR(ret);
}
/*
* We expect partial matches, and want the smallest record with a key
* greater than or equal to the search key.
*
* If the found key starts with the search key, we indicate a match by
* setting exact equal to zero.
*
* The compare function expects application-supplied keys to come first
* so we flip the sign of the result to match what callers expect.
*/
found_key = child->key;
if (found_key.size > cursor->key.size)
found_key.size = cursor->key.size;
WT_ERR(__wt_compare(
session, cindex->index->collator, &cursor->key, &found_key, exact));
*exact = -*exact;
WT_ERR(__curindex_move(cindex));
if (0) {
err: F_CLR(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
}
API_END_RET(session, ret);
}
开发者ID:ksuarz,项目名称:mongo,代码行数:64,代码来源:cur_index.c
示例16: __curlog_search
/*
* __curlog_search --
* WT_CURSOR.search method for the log cursor type.
*/
static int
__curlog_search(WT_CURSOR *cursor)
{
WT_CURSOR_LOG *cl;
WT_DECL_RET;
WT_LSN key;
WT_SESSION_IMPL *session;
uint32_t counter;
cl = (WT_CURSOR_LOG *)cursor;
CURSOR_API_CALL(cursor, session, search, NULL);
/*
* !!! We are ignoring the counter and only searching based on the LSN.
*/
WT_ERR(__wt_cursor_get_key((WT_CURSOR *)cl,
&key.file, &key.offset, &counter));
WT_ERR(__wt_log_scan(session, &key, WT_LOGSCAN_ONE,
__curlog_logrec, cl));
WT_ERR(__curlog_kv(session, cursor));
WT_STAT_FAST_CONN_INCR(session, cursor_search);
WT_STAT_FAST_DATA_INCR(session, cursor_search);
err: API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:30,代码来源:cur_log.c
示例17: __curmetadata_next
/*
* __curmetadata_next --
* WT_CURSOR->next method for the metadata cursor type.
*/
static int
__curmetadata_next(WT_CURSOR *cursor)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
next, ((WT_CURSOR_BTREE *)file_cursor)->btree);
if (!F_ISSET(mdc, WT_MDC_POSITIONED))
WT_ERR(__curmetadata_metadata_search(session, cursor));
else {
WT_ERR(file_cursor->next(mdc->file_cursor));
WT_MD_SET_KEY_VALUE(cursor, mdc, file_cursor);
}
err: if (ret != 0) {
F_CLR(mdc, WT_MDC_POSITIONED | WT_MDC_ONMETADATA);
F_CLR(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_VALUE_EXT);
}
API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:30,代码来源:cur_metadata.c
示例18: __curlog_next
/*
* __curlog_next --
* WT_CURSOR.next method for the step log cursor type.
*/
static int
__curlog_next(WT_CURSOR *cursor)
{
WT_CURSOR_LOG *cl;
WT_DECL_RET;
WT_SESSION_IMPL *session;
cl = (WT_CURSOR_LOG *)cursor;
CURSOR_API_CALL(cursor, session, next, NULL);
/*
* If we don't have a record, or went to the end of the record we
* have, or we are in the zero-fill portion of the record, get a
* new one.
*/
if (cl->stepp == NULL || cl->stepp >= cl->stepp_end || !*cl->stepp) {
cl->txnid = 0;
WT_ERR(__wt_log_scan(session, cl->next_lsn, WT_LOGSCAN_ONE,
__curlog_logrec, cl));
}
WT_ASSERT(session, cl->logrec->data != NULL);
WT_ERR(__curlog_kv(session, cursor));
WT_STAT_FAST_CONN_INCR(session, cursor_next);
WT_STAT_FAST_DATA_INCR(session, cursor_next);
err: API_END_RET(session, ret);
}
开发者ID:EaseTech,项目名称:wiredtiger,代码行数:33,代码来源:cur_log.c
示例19: __curmetadata_next
/*
* __curmetadata_next --
* WT_CURSOR->next method for the metadata cursor type.
*/
static int
__curmetadata_next(WT_CURSOR *cursor)
{
WT_CURSOR *file_cursor;
WT_CURSOR_METADATA *mdc;
WT_DECL_RET;
WT_SESSION_IMPL *session;
mdc = (WT_CURSOR_METADATA *)cursor;
file_cursor = mdc->file_cursor;
CURSOR_API_CALL(cursor, session,
next, ((WT_CURSOR_BTREE *)file_cursor)->btree);
if (!F_ISSET(mdc, WT_MDC_POSITIONED))
WT_ERR(__curmetadata_metadata_search(session, cursor));
else {
/*
* When applications open metadata cursors, they expect to see
* all schema-level operations reflected in the results. Query
* at read-uncommitted to avoid confusion caused by the current
* transaction state.
*/
WT_WITH_TXN_ISOLATION(session, WT_ISO_READ_UNCOMMITTED,
ret = file_cursor->next(mdc->file_cursor));
WT_ERR(ret);
WT_ERR(__curmetadata_setkv(mdc, file_cursor));
}
err: if (ret != 0) {
F_CLR(mdc, WT_MDC_POSITIONED | WT_MDC_ONMETADATA);
F_CLR(cursor, WT_CURSTD_KEY_EXT | WT_CURSTD_VALUE_EXT);
}
API_END_RET(session, ret);
}
开发者ID:GYGit,项目名称:mongo,代码行数:38,代码来源:cur_metadata.c
示例20: __curindex_search
/*
* __curindex_search --
* WT_CURSOR->search method for index cursors.
*/
static int
__curindex_search(WT_CURSOR *cursor)
{
WT_CURSOR *child;
WT_CURSOR_INDEX *cindex;
WT_DECL_RET;
WT_ITEM found_key;
WT_SESSION_IMPL *session;
int cmp;
cindex = (WT_CURSOR_INDEX *)cursor;
child = cindex->child;
JOINABLE_CURSOR_API_CALL(cursor, session, search, NULL);
/*
* We are searching using the application-specified key, which
* (usually) doesn't contain the primary key, so it is just a prefix of
* any matching index key. Do a search_near, step to the next entry if
* we land on one that is too small, then check that the prefix
* matches.
*/
__wt_cursor_set_raw_key(child, &cursor->key);
WT_ERR(child->search_near(child, &cmp));
if (cmp < 0)
WT_ERR(child->next(child));
/*
* We expect partial matches, and want the smallest record with a key
* greater than or equal to the search key.
*
* If the key we find is shorter than the search key, it can't possibly
* match.
*
* The only way for the key to be exactly equal is if there is an index
* on the primary key, because otherwise the primary key columns will
* be appended to the index key, but we don't disallow that (odd) case.
*/
found_key = child->key;
if (found_key.size < cursor->key.size)
WT_ERR(WT_NOTFOUND);
found_key.size = cursor->key.size;
WT_ERR(__wt_compare(
session, cindex->index->collator, &cursor->key, &found_key, &cmp));
if (cmp != 0) {
ret = WT_NOTFOUND;
goto err;
}
WT_ERR(__curindex_move(cindex));
if (0) {
err: F_CLR(cursor, WT_CURSTD_KEY_INT | WT_CURSTD_VALUE_INT);
}
API_END_RET(session, ret);
}
开发者ID:ksuarz,项目名称:mongo,代码行数:62,代码来源:cur_index.c
注:本文中的API_END_RET函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论