In addition to skink post - try to use prepared/compiled statements:
Object[] params = new Object[3];
SQLiteStatement statement = compileStatement("INSERT INTO my_table
VALUES(?,?,?)");
// loop here
for(...) {
params[0] = ...
params[1] = ...
params[2] = ...
DatabaseUtils.bindObjectToProgram(statement, 1, params[0]);
DatabaseUtils.bindObjectToProgram(statement, 2, params[1]);
DatabaseUtils.bindObjectToProgram(statement, 3, params[2]);
statement.execute();
}
On Sep 2, 10:59 pm, skink <[email protected]> wrote:
> On Sep 2, 7:18 pm, mjc147 <[email protected]> wrote:Am I
>
> > missing something here?
>
> > I use execSQL("INSERT INTO my_table VALUES(?,?,?)", new Object[]
> > {1,2,3}) and perform on average 10 calls per transaction.
>
> did you try allocating params array once?
>
> Object[] params = new Object[3];
>
> // loop here
> for(...) {
> params[0] = ...
> params[1] = ...
> params[2] = ...
> execSQL("INSERT INTO my_table VALUES(?,?,?)", params)
>
> }
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---