记录一下sqlite批量操作的写法
try { sqliteDatabase db = DBHelper.getDatabase(); String sql = "INSERT INTO " + TABLE + "(col_1,col_2,col_3)VALUES(?,?,?)"; sqliteStatement statement = db.compileStatement(sql); db.beginTransaction(); for (Object item : items) { statement.bindString(1,item.val_1); statement.bindString(2,item.val_2); statement.bindString(3,item.val_3); statement.executeInsert(); } db.setTransactionSuccessful(); } catch (Exception e) { e.printStackTrace(); } finally { db.endTransaction(); }原文链接:https://www.f2er.com/sqlite/199502.html