本文整理匯總了Java中com.sleepycat.je.Cursor.getCurrent方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.getCurrent方法的具體用法?Java Cursor.getCurrent怎麽用?Java Cursor.getCurrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sleepycat.je.Cursor
的用法示例。
在下文中一共展示了Cursor.getCurrent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSR9992
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
public void testSR9992()
throws DatabaseException {
initEnvTransactional(true);
Transaction txn = exampleEnv.beginTransaction(null, null);
Cursor c = exampleDb.openCursor(txn, null);
for (int i = 1; i < simpleKeys.length; i++) {
c.put(simpleKeys[0], simpleData[i]);
}
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
c.getCurrent(key, data, LockMode.DEFAULT);
c.delete();
/* Expect "Can't replace a duplicate with different data." */
assertEquals(OperationStatus.NOTFOUND,
c.putCurrent(new DatabaseEntry("aaaa".getBytes())));
c.close();
txn.commit();
}
示例2: testSR9900
import com.sleepycat.je.Cursor; //導入方法依賴的package包/類
public void testSR9900()
throws DatabaseException {
initEnvTransactional(true);
Transaction txn = exampleEnv.beginTransaction(null, null);
Cursor c = exampleDb.openCursor(txn, null);
c.put(simpleKeys[0], simpleData[0]);
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry data = new DatabaseEntry();
c.getCurrent(key, data, LockMode.DEFAULT);
c.delete();
/* Expect "Can't replace a duplicate with different data." */
assertEquals(OperationStatus.NOTFOUND,
c.putCurrent(new DatabaseEntry("aaaa".getBytes())));
c.close();
txn.commit();
}