findFirstRow
当我尝试使用 Jackcess 查找需要删除的行以删除表时,为什么无法光标?
private static void deleteTable(Database db, String tableName) throws IOException {
Table table = db.getSystemTable(tableName);
if (table == null) {
return;
}
Cursor cursor = table.getDefaultCursor();
Map<String, Object> criteria = new HashMap<String, Object>();
criteria.put("Name", tableName);
criteria.put("Type", (short) 1);
if (cursor.findFirstRow(criteria)) {
table.deleteRow(cursor.getCurrentRow());
Log.e(TAG, "delete " + tableName + " success!");
} else {
Log.e(TAG, "can't find this Table");//run here
}
db.flush();
db.close();
}
ps:没有报告异常