Skip to content

Instantly share code, notes, and snippets.

@r17171709
Created June 6, 2015 04:45
Show Gist options
  • Save r17171709/e35d1ea93363670ea831 to your computer and use it in GitHub Desktop.
Save r17171709/e35d1ea93363670ea831 to your computer and use it in GitHub Desktop.
try {
db.beginTransaction();
String[][] lifes = {{"potato", "tomato", "apple"}, {"rat", "cat", "dog"}};
SQLiteStatement stmt = db.compileStatement("insert into life values(?,?)");
for(int i=0;i<lifes[0].length;i++){
stmt.clearBindings();
stmt.bindString(1, lifes[0][i]);
stmt.bindString(1, lifes[1][i]);
stmt.executeInsert();
}
db.setTransactionSuccessful();
} catch (Exception e) {
}finally{
db.endTransaction();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment