diff options
| author | Vasu Nori <vnori@google.com> | 2010-07-29 17:24:12 -0700 |
|---|---|---|
| committer | Vasu Nori <vnori@google.com> | 2010-08-03 10:48:14 -0700 |
| commit | 0732f7912ccec9a1cc379b535ac0b56ae50972b3 (patch) | |
| tree | 20b6b181bee9a78616ffc856c03e77426fb80e80 /core/java/android/database/DatabaseUtils.java | |
| parent | a275354c54b372bdfaae429fd2a2f5c2bdcd5d1e (diff) | |
random but useful stuff
1. move binding of args to one place - to SQLiteProgram
2. reduce locking time in SQLiteDatabase
3. reduce locking during time of binding of args
4. rmeove test for the deprecated ArrayListCursor
5. a couple of nits here and there
Change-Id: I20c33c8ffe3325df67af655f1d20614f7f727cb7
Diffstat (limited to 'core/java/android/database/DatabaseUtils.java')
| -rw-r--r-- | core/java/android/database/DatabaseUtils.java | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/core/java/android/database/DatabaseUtils.java b/core/java/android/database/DatabaseUtils.java index 0687659e9481..9ac45d81105a 100644 --- a/core/java/android/database/DatabaseUtils.java +++ b/core/java/android/database/DatabaseUtils.java @@ -678,14 +678,8 @@ public class DatabaseUtils { * first column of the first row. */ public static long longForQuery(SQLiteStatement prog, String[] selectionArgs) { - if (selectionArgs != null) { - int size = selectionArgs.length; - for (int i = 0; i < size; i++) { - bindObjectToProgram(prog, i + 1, selectionArgs[i]); - } - } - long value = prog.simpleQueryForLong(); - return value; + prog.bindAllArgsAsStrings(selectionArgs); + return prog.simpleQueryForLong(); } /** @@ -706,14 +700,8 @@ public class DatabaseUtils { * first column of the first row. */ public static String stringForQuery(SQLiteStatement prog, String[] selectionArgs) { - if (selectionArgs != null) { - int size = selectionArgs.length; - for (int i = 0; i < size; i++) { - bindObjectToProgram(prog, i + 1, selectionArgs[i]); - } - } - String value = prog.simpleQueryForString(); - return value; + prog.bindAllArgsAsStrings(selectionArgs); + return prog.simpleQueryForString(); } /** |
