3 ms·
I usually use the following code for this purpose: public void testBatchInserts() throws PerformanceTestException { SQLiteStatement stmt = db.compileSta
by AmelnCam 12y ago
I usually use the following code for this purpose:
public void testBatchInserts() throws PerformanceTestException {
SQLiteStatement stmt = db.compileStatement("INSERT INTO "
+ EmployeeDatabaseHelper.TABLE_EMPLOYEES + " VALUES(?1, ?2, ?3, ?4)");
db.beginTransaction();
for (int row = 0; row < getNumInserts(); row++) {
stmt.clearBindings();
stmt.bindString(2, getEmployeeName(row));
stmt.bindLong(3, getEmployeeAge(row));
stmt.bindLong(4, getEmployeeHiredStatus(row));
stmt.executeInsert();
}
db.setTransactionSuccessful();
db.endTransaction();