/* * __curfile_remove -- * WT_CURSOR->remove method for the btree cursor type. */ static int __curfile_remove(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, remove, cbt->btree); WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NOVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_remove(cbt), ret); /* * After a successful remove, copy the key: the value is not available. */ if (ret == 0) { if (F_ISSET(cursor, WT_CURSTD_KEY_INT) && !WT_DATA_IN_ITEM(&(cursor)->key)) { WT_ERR(__wt_buf_set(session, &cursor->key, cursor->key.data, cursor->key.size)); F_CLR(cursor, WT_CURSTD_KEY_INT); F_SET(cursor, WT_CURSTD_KEY_EXT); } F_CLR(cursor, WT_CURSTD_VALUE_SET); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_insert -- * WT_CURSOR->insert method for the btree cursor type. */ static int __curfile_insert(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, insert, cbt->btree); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_insert(cbt), ret); /* * Insert is the one cursor operation that doesn't end with the cursor * pointing to an on-page item. The standard macro handles errors * correctly, but we need to leave the application cursor unchanged in * the case of success, except for column-store appends, where we are * returning a key. */ if (ret == 0) { if (!F_ISSET(cursor, WT_CURSTD_APPEND)) { F_SET(cursor, WT_CURSTD_KEY_EXT); F_CLR(cursor, WT_CURSTD_KEY_INT); } F_SET(cursor, WT_CURSTD_VALUE_EXT); F_CLR(cursor, WT_CURSTD_VALUE_INT); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_insert -- * WT_CURSOR->insert method for the btree cursor type. */ static int __curfile_insert(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, insert, cbt->btree); if (!F_ISSET(cursor, WT_CURSTD_APPEND)) WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_insert(cbt), ret); /* * Insert is the one cursor operation that doesn't end with the cursor * pointing to an on-page item (except for column-store appends, where * we are returning a key). That is, the application's cursor continues * to reference the application's memory after a successful cursor call, * which isn't true anywhere else. We don't want to have to explain that * scoping corner case, so we reset the application's cursor so it can * free the referenced memory and continue on without risking subsequent * core dumps. */ if (ret == 0) { if (!F_ISSET(cursor, WT_CURSTD_APPEND)) F_CLR(cursor, WT_CURSTD_KEY_INT); F_CLR(cursor, WT_CURSTD_VALUE_INT); } err: CURSOR_UPDATE_API_END(session, ret); return (ret); }
/* * __curfile_search -- * WT_CURSOR->search method for the btree cursor type. */ static int __curfile_search(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_API_CALL(cursor, session, search, cbt->btree); WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NOVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_search(cbt), ret); err: API_END_RET(session, ret); }
/* * __curfile_update -- * WT_CURSOR->update method for the btree cursor type. */ static int __curfile_update(WT_CURSOR *cursor) { WT_CURSOR_BTREE *cbt; WT_DECL_RET; WT_SESSION_IMPL *session; cbt = (WT_CURSOR_BTREE *)cursor; CURSOR_UPDATE_API_CALL(cursor, session, update, cbt->btree); WT_CURSOR_NEEDKEY(cursor); WT_CURSOR_NEEDVALUE(cursor); WT_BTREE_CURSOR_SAVE_AND_RESTORE(cursor, __wt_btcur_update(cbt), ret); err: CURSOR_UPDATE_API_END(session, ret); return (ret); }