public void addIndexs(List<SearchIndex> newIndexs) {
if (newIndexs == null || newIndexs.size() == 0)
return;
sqliteDatabase database = sqliteDatabase.openDatabase(dbPath,PWD,null,sqliteDatabase.OPEN_READWRITE);
//sqliteDatabase database = sqliteDatabase.openDatabase(dbPath,sqliteDatabase.OPEN_READWRITE);
String insertsql = "INSERT INTO SearchIndex VALUES (?,?,?)";
String deletesql = "delete from SearchIndex where (StaffID=? or StaffID=?)";
database.beginTransaction();
SearchIndex tempIndex = null;
for (int i = 0; i < newIndexs.size(); i++) {
tempIndex = newIndexs.get(i);
database.execsql(
deletesql,
new String[] { tempIndex.S.toUpperCase(),
tempIndex.S.toLowerCase() });
database.execsql(insertsql,new String[] { tempIndex.S,
tempIndex.N,tempIndex.J,tempIndex.P,tempIndex.L,
tempIndex.E});
}
database.setTransactionSuccessful();
database.endTransaction();
database.close();
}