I want to insert records into the table several times, I have the choice to either use compileStatement or use db.insert, as shown below.
String TABLENAME = "table";
SQLiteStatement statement = db.compileStatement("INSERT INTO "+TABLENAME+" VALUES(?,?);");
statement.bindLong(1,666);
statement.bindString(2,"john");
statement.executeInsert();
or
String TABLENAME = "table";
ContentValues values = new ContentValues();
values.put("id", 666);
values.put("name", "john");
db.insert(TABLENAME, null, values);
Which one should be optimal?
EDIT: - The application that I run is single-threaded.
source
share