日期:2014-05-16 浏览次数:20433 次
try { String searchName = "John Doe"; DatabaseEntry searchKey = new DatabaseEntry(searchName.getBytes("UTF-8")); DatabaseEntry primaryKey = new DatabaseEntry(); DatabaseEntry primaryData = new DatabaseEntry(); OperationStatus retVal = mySecondaryDatabase.get(null, searchKey, primaryKey, primaryData, LockMode.DEFAULT); } catch (Exception e) { }
try { String searchName = "John Doe"; DatabaseEntry searchKey = new DatabaseEntry(searchName.getBytes("UTF-8")); OperationStatus retVal = mySecondaryDatabase.delete(null, searchKey); } catch (Exception e) { }
try { DatabaseEntry secondaryKey = new DatabaseEntry(secondaryName.getBytes("UTF-8")); DatabaseEntry foundData = new DatabaseEntry(); SecondaryCursor mySecCursor = mySecondaryDatabase.openSecondaryCursor(null, null); OperationStatus retVal = mySecCursor.getSearchKey(secondaryKey, foundData, LockMode.DEFAULT); while (retVal == OperationStatus.SUCCESS) { mySecCursor.delete(); retVal = mySecCursor.getNextDup(secondaryKey, foundData, LockMode.DEFAULT); } } catch (Exception e) { }
String theSex = "female"; String theAge = "20"; SecondaryCursor sexSecCursor = null; SecondaryCursor ageSecCursor = null; JoinCursor joinCursor = null; DatabaseEntry foundKey = new DatabaseEntry(); DatabaseEntry foundData = new DatabaseEntry(); try { DatabaseEntry sex = new DatabaseEntry(theSex.getBytes("UTF-8")); DatabaseEntry age = new DatabaseEntry(theAge.getBytes("UTF-8")); sexSecCursor = sexDB.openSecondaryCursor(null, null); ageSecCursor = ageDB.openSecondaryCursor(null, null); OperationStatus sexRet = sexSecCursor.getSearchKey(sex, foundData, LockMode.DEFAUL