SQLite Android Bindings
Check-in [7e57f15de2]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Commit the various hacks to android files made outside of fossil.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7e57f15de2d70c9f053347e55b89e7437f3becfe
User & Date: dan 2013-12-18 17:23:55
Context
2013-12-18
17:36
Update CustomSqlite.java to call "SELECT sqlite_version()". check-in: 71a3449ef6 user: dan tags: trunk
17:23
Commit the various hacks to android files made outside of fossil. check-in: 7e57f15de2 user: dan tags: trunk
17:02
Copy in some Android files. check-in: 77eacc52c5 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added jni/Android.mk.

            1  +LOCAL_PATH:= $(call my-dir)
            2  +include $(CLEAR_VARS)
            3  +
            4  +ANDROIDSRC = /home/dan/big/Android
            5  +
            6  +JNI_H_INCLUDE = $(ANDROIDSRC)/libnativehelper/include/nativehelper/
            7  +
            8  +LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
            9  +LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
           10  +LOCAL_CFLAGS += -U__APPLE__
           11  +LOCAL_CFLAGS += -Wno-unused-parameter -Wno-int-to-pointer-cast
           12  +LOCAL_CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses
           13  +LOCAL_CPPFLAGS += -Wno-conversion-null
           14  +
           15  +ifeq ($(TARGET_ARCH), arm)
           16  +	LOCAL_CFLAGS += -DPACKED="__attribute__ ((packed))"
           17  +else
           18  +	LOCAL_CFLAGS += -DPACKED=""
           19  +endif
           20  +
           21  +LOCAL_SRC_FILES:= \
           22  +	android_database_SQLiteCommon.cpp \
           23  +	android_database_SQLiteConnection.cpp \
           24  +	android_database_SQLiteGlobal.cpp \
           25  +	android_database_SQLiteDebug.cpp  \
           26  +	sqlite3.c
           27  +
           28  +LOCAL_SRC_FILES += \
           29  +	JNIHelp.cpp \
           30  +	JniConstants.cpp 
           31  +
           32  +
           33  +LOCAL_C_INCLUDES += \
           34  +	$(JNI_H_INCLUDE) \
           35  +	$(ANDROIDSRC)/system/core/include/ \
           36  +	$(ANDROIDSRC)/frameworks/base/include/ \
           37  +	$(ANDROIDSRC)/frameworks/native/include/ \
           38  +	$(ANDROIDSRC)/libnativehelper/include/ \
           39  +	$(ANDROIDSRC)/frameworks/base/core/jni \
           40  +
           41  +
           42  +LOCAL_MODULE:= libsqliteX
           43  +
           44  +LOCAL_LDLIBS += -ldl -llog 
           45  +# LOCAL_LDLIBS += -lnativehelper -landroid_runtime -lutils -lbinder
           46  +
           47  +include $(BUILD_SHARED_LIBRARY)
           48  +

Added jni/Application.mk.

            1  +APP_STL:=stlport_static

Changes to jni/JNIHelp.cpp.

    69     69   
    70     70   extern "C" int jniRegisterNativeMethods(C_JNIEnv* env, const char* className,
    71     71       const JNINativeMethod* gMethods, int numMethods)
    72     72   {
    73     73       JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
    74     74   
    75     75       ALOGV("Registering %s's %d native methods...", className, numMethods);
           76  +    __android_log_print(ANDROID_LOG_INFO,  __FUNCTION__, "Registering");
    76     77   
    77     78       scoped_local_ref<jclass> c(env, findClass(env, className));
    78     79       if (c.get() == NULL) {
    79     80           char* msg;
    80     81           asprintf(&msg, "Native registration unable to find class '%s'; aborting...", className);
    81     82           e->FatalError(msg);
    82     83       }

Changes to jni/android_database_SQLiteCommon.cpp.

   116    116               exceptionClass = "android/os/OperationCanceledException";
   117    117               break;
   118    118           default:
   119    119               exceptionClass = "android/database/sqlite/SQLiteException";
   120    120               break;
   121    121       }
   122    122   
   123         -    if (sqlite3Message) {
          123  +    if (0 && sqlite3Message) {
          124  +#if 0
   124    125           String8 fullMessage;
   125    126           fullMessage.append(sqlite3Message);
   126    127           fullMessage.appendFormat(" (code %d)", errcode); // print extended error code
   127    128           if (message) {
   128    129               fullMessage.append(": ");
   129    130               fullMessage.append(message);
   130    131           }
   131    132           jniThrowException(env, exceptionClass, fullMessage.string());
          133  +#endif
   132    134       } else {
   133    135           jniThrowException(env, exceptionClass, message);
   134    136       }
   135    137   }
   136    138   
   137    139   
   138    140   } // namespace android

Changes to jni/android_database_SQLiteConnection.cpp.

    29     29   
    30     30   #include <string.h>
    31     31   #include <unistd.h>
    32     32   
    33     33   #include <androidfw/CursorWindow.h>
    34     34   
    35     35   #include <sqlite3.h>
           36  +#if 0
    36     37   #include <sqlite3_android.h>
           38  +#endif
    37     39   
    38     40   #include "android_database_SQLiteCommon.h"
           41  +
           42  +#include <string>
    39     43   
    40     44   // Set to 1 to use UTF16 storage for localized indexes.
    41     45   #define UTF16_STORAGE 0
    42     46   
    43     47   namespace android {
    44     48   
    45     49   /* Busy timeout in milliseconds.
................................................................................
    51     55    * have a single open connection at a time unless they are using WAL.  When using
    52     56    * WAL, a timeout could occur if one connection is busy performing an auto-checkpoint
    53     57    * operation.  The busy timeout needs to be long enough to tolerate slow I/O write
    54     58    * operations but not so long as to cause the application to hang indefinitely if
    55     59    * there is a problem acquiring a database lock.
    56     60    */
    57     61   static const int BUSY_TIMEOUT_MS = 2500;
           62  +
           63  +static JavaVM *gpJavaVM = 0;
    58     64   
    59     65   static struct {
    60     66       jfieldID name;
    61     67       jfieldID numArgs;
    62     68       jmethodID dispatchCallback;
    63     69   } gSQLiteCustomFunctionClassInfo;
    64     70   
................................................................................
    75     81           OPEN_READ_MASK          = 0x00000001,
    76     82           NO_LOCALIZED_COLLATORS  = 0x00000010,
    77     83           CREATE_IF_NECESSARY     = 0x10000000,
    78     84       };
    79     85   
    80     86       sqlite3* const db;
    81     87       const int openFlags;
    82         -    const String8 path;
    83         -    const String8 label;
           88  +    std::string path;
           89  +    std::string label;
    84     90   
    85     91       volatile bool canceled;
    86     92   
    87         -    SQLiteConnection(sqlite3* db, int openFlags, const String8& path, const String8& label) :
           93  +    SQLiteConnection(sqlite3* db, int openFlags, const std::string& path, const std::string& label) :
    88     94           db(db), openFlags(openFlags), path(path), label(label), canceled(false) { }
    89     95   };
    90     96   
    91     97   // Called each time a statement begins execution, when tracing is enabled.
    92     98   static void sqliteTraceCallback(void *data, const char *sql) {
    93     99       SQLiteConnection* connection = static_cast<SQLiteConnection*>(data);
    94    100       ALOG(LOG_VERBOSE, SQLITE_TRACE_TAG, "%s: \"%s\"\n",
    95         -            connection->label.string(), sql);
          101  +            connection->label.c_str(), sql);
    96    102   }
    97    103   
    98    104   // Called each time a statement finishes execution, when profiling is enabled.
    99    105   static void sqliteProfileCallback(void *data, const char *sql, sqlite3_uint64 tm) {
   100    106       SQLiteConnection* connection = static_cast<SQLiteConnection*>(data);
   101    107       ALOG(LOG_VERBOSE, SQLITE_PROFILE_TAG, "%s: \"%s\" took %0.3f ms\n",
   102         -            connection->label.string(), sql, tm * 0.000001f);
          108  +            connection->label.c_str(), sql, tm * 0.000001f);
   103    109   }
   104    110   
   105    111   // Called after each SQLite VM instruction when cancelation is enabled.
   106    112   static int sqliteProgressHandlerCallback(void* data) {
   107    113       SQLiteConnection* connection = static_cast<SQLiteConnection*>(data);
   108    114       return connection->canceled;
   109    115   }
................................................................................
   117    123       } else if (openFlags & SQLiteConnection::OPEN_READONLY) {
   118    124           sqliteFlags = SQLITE_OPEN_READONLY;
   119    125       } else {
   120    126           sqliteFlags = SQLITE_OPEN_READWRITE;
   121    127       }
   122    128   
   123    129       const char* pathChars = env->GetStringUTFChars(pathStr, NULL);
   124         -    String8 path(pathChars);
          130  +    std::string path(pathChars);
   125    131       env->ReleaseStringUTFChars(pathStr, pathChars);
   126    132   
   127    133       const char* labelChars = env->GetStringUTFChars(labelStr, NULL);
   128         -    String8 label(labelChars);
          134  +    std::string label(labelChars);
   129    135       env->ReleaseStringUTFChars(labelStr, labelChars);
   130    136   
   131    137       sqlite3* db;
   132         -    int err = sqlite3_open_v2(path.string(), &db, sqliteFlags, NULL);
          138  +    int err = sqlite3_open_v2(path.c_str(), &db, sqliteFlags, NULL);
   133    139       if (err != SQLITE_OK) {
   134    140           throw_sqlite3_exception_errcode(env, err, "Could not open database");
   135    141           return 0;
   136    142       }
   137    143   
   138    144       // Check that the database is really read/write when that is what we asked for.
   139    145       if ((sqliteFlags & SQLITE_OPEN_READWRITE) && sqlite3_db_readonly(db, NULL)) {
................................................................................
   147    153       if (err != SQLITE_OK) {
   148    154           throw_sqlite3_exception(env, db, "Could not set busy timeout");
   149    155           sqlite3_close(db);
   150    156           return 0;
   151    157       }
   152    158   
   153    159       // Register custom Android functions.
          160  +#if 0
   154    161       err = register_android_functions(db, UTF16_STORAGE);
   155    162       if (err) {
   156    163           throw_sqlite3_exception(env, db, "Could not register Android SQL functions.");
   157    164           sqlite3_close(db);
   158    165           return 0;
   159    166       }
          167  +#endif
   160    168   
   161    169       // Create wrapper object.
   162    170       SQLiteConnection* connection = new SQLiteConnection(db, openFlags, path, label);
   163    171   
   164    172       // Enable tracing and profiling if requested.
   165    173       if (enableTrace) {
   166    174           sqlite3_trace(db, &sqliteTraceCallback, connection);
   167    175       }
   168    176       if (enableProfile) {
   169    177           sqlite3_profile(db, &sqliteProfileCallback, connection);
   170    178       }
   171    179   
   172         -    ALOGV("Opened connection %p with label '%s'", db, label.string());
          180  +    ALOGV("Opened connection %p with label '%s'", db, label.c_str());
   173    181       return reinterpret_cast<jint>(connection);
   174    182   }
   175    183   
   176    184   static void nativeClose(JNIEnv* env, jclass clazz, jint connectionPtr) {
   177    185       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   178    186   
   179    187       if (connection) {
................................................................................
   189    197           delete connection;
   190    198       }
   191    199   }
   192    200   
   193    201   // Called each time a custom function is evaluated.
   194    202   static void sqliteCustomFunctionCallback(sqlite3_context *context,
   195    203           int argc, sqlite3_value **argv) {
   196         -    JNIEnv* env = AndroidRuntime::getJNIEnv();
          204  +
          205  +    JNIEnv* env = 0;
          206  +    gpJavaVM->GetEnv((void**)&env, JNI_VERSION_1_4);
   197    207   
   198    208       // Get the callback function object.
   199    209       // Create a new local reference to it in case the callback tries to do something
   200    210       // dumb like unregister the function (thereby destroying the global ref) while it is running.
   201    211       jobject functionObjGlobal = reinterpret_cast<jobject>(sqlite3_user_data(context));
   202    212       jobject functionObj = env->NewLocalRef(functionObjGlobal);
   203    213   
................................................................................
   234    244           env->ExceptionClear();
   235    245       }
   236    246   }
   237    247   
   238    248   // Called when a custom function is destroyed.
   239    249   static void sqliteCustomFunctionDestructor(void* data) {
   240    250       jobject functionObjGlobal = reinterpret_cast<jobject>(data);
   241         -
   242         -    JNIEnv* env = AndroidRuntime::getJNIEnv();
          251  +    JNIEnv* env = 0;
          252  +    gpJavaVM->GetEnv((void**)&env, JNI_VERSION_1_4);
   243    253       env->DeleteGlobalRef(functionObjGlobal);
   244    254   }
   245    255   
   246    256   static void nativeRegisterCustomFunction(JNIEnv* env, jclass clazz, jint connectionPtr,
   247    257           jobject functionObj) {
   248    258       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   249    259   
................................................................................
   268    278   }
   269    279   
   270    280   static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jint connectionPtr,
   271    281           jstring localeStr) {
   272    282       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   273    283   
   274    284       const char* locale = env->GetStringUTFChars(localeStr, NULL);
          285  +#if 0
   275    286       int err = register_localized_collators(connection->db, locale, UTF16_STORAGE);
   276    287       env->ReleaseStringUTFChars(localeStr, locale);
   277    288   
   278    289       if (err != SQLITE_OK) {
   279    290           throw_sqlite3_exception(env, connection->db);
   280    291       }
          292  +#endif
   281    293   }
   282    294   
   283    295   static jint nativePrepareStatement(JNIEnv* env, jclass clazz, jint connectionPtr,
   284    296           jstring sqlString) {
   285    297       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   286    298   
   287    299       jsize sqlLength = env->GetStringLength(sqlString);
................................................................................
   510    522               return env->NewString(text, length);
   511    523           }
   512    524       }
   513    525       return NULL;
   514    526   }
   515    527   
   516    528   static int createAshmemRegionWithData(JNIEnv* env, const void* data, size_t length) {
          529  +#if 0
   517    530       int error = 0;
   518    531       int fd = ashmem_create_region(NULL, length);
   519    532       if (fd < 0) {
   520    533           error = errno;
   521    534           ALOGE("ashmem_create_region failed: %s", strerror(error));
   522    535       } else {
   523    536           if (length > 0) {
................................................................................
   539    552                   return fd;
   540    553               }
   541    554           }
   542    555   
   543    556           close(fd);
   544    557       }
   545    558   
   546         -    jniThrowIOException(env, error);
          559  +#endif
          560  +    jniThrowIOException(env, -1);
   547    561       return -1;
   548    562   }
   549    563   
   550    564   static jint nativeExecuteForBlobFileDescriptor(JNIEnv* env, jclass clazz,
   551    565           jint connectionPtr, jint statementPtr) {
   552    566       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   553    567       sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
................................................................................
   567    581   
   568    582   enum CopyRowResult {
   569    583       CPR_OK,
   570    584       CPR_FULL,
   571    585       CPR_ERROR,
   572    586   };
   573    587   
          588  +static jlong nativeExecuteForCursorWindow(
          589  +  JNIEnv* env, jclass clazz,
          590  +  jint connectionPtr, 
          591  +  jint statementPtr, 
          592  +  jint windowPtr,
          593  +  jint startPos, 
          594  +  jint requiredPos, 
          595  +  jboolean countAllRows
          596  +) {
          597  +  jniThrowIOException(env, -1);
          598  +  return -1;
          599  +}
          600  +
          601  +#if 0
   574    602   static CopyRowResult copyRow(JNIEnv* env, CursorWindow* window,
   575    603           sqlite3_stmt* statement, int numColumns, int startPos, int addedRows) {
   576    604       // Allocate a new field directory for the row.
   577    605       status_t status = window->allocRow();
   578    606       if (status) {
   579    607           LOG_WINDOW("Failed allocating fieldDir at startPos %d row %d, error=%d",
   580    608                   startPos, addedRows, status);
................................................................................
   669    697           jint startPos, jint requiredPos, jboolean countAllRows) {
   670    698       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   671    699       sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr);
   672    700       CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr);
   673    701   
   674    702       status_t status = window->clear();
   675    703       if (status) {
   676         -        String8 msg;
   677         -        msg.appendFormat("Failed to clear the cursor window, status=%d", status);
   678         -        throw_sqlite3_exception(env, connection->db, msg.string());
          704  +        char *zMsg = sqlite3_mprintf(
          705  +            "Failed to clear the cursor window, status=%d", status
          706  +        );
          707  +        throw_sqlite3_exception(env, connection->db, zMsg);
          708  +        sqlite3_free(zMsg);
   679    709           return 0;
   680    710       }
   681    711   
   682    712       int numColumns = sqlite3_column_count(statement);
   683    713       status = window->setNumColumns(numColumns);
   684    714       if (status) {
   685         -        String8 msg;
   686         -        msg.appendFormat("Failed to set the cursor window column count to %d, status=%d",
   687         -                numColumns, status);
   688         -        throw_sqlite3_exception(env, connection->db, msg.string());
          715  +        char *zMsg = sqlite3_mprintf(
          716  +            "Failed to set the cursor window column count to %d, status=%d",
          717  +            numColumns, status
          718  +        );
          719  +        throw_sqlite3_exception(env, connection->db, zMsg);
          720  +        sqlite3_free(zMsg);
   689    721           return 0;
   690    722       }
   691    723   
   692    724       int retryCount = 0;
   693    725       int totalRows = 0;
   694    726       int addedRows = 0;
   695    727       bool windowFull = false;
................................................................................
   755    787       // Report the total number of rows on request.
   756    788       if (startPos > totalRows) {
   757    789           ALOGE("startPos %d > actual rows %d", startPos, totalRows);
   758    790       }
   759    791       jlong result = jlong(startPos) << 32 | jlong(totalRows);
   760    792       return result;
   761    793   }
          794  +#endif
   762    795   
   763    796   static jint nativeGetDbLookaside(JNIEnv* env, jobject clazz, jint connectionPtr) {
   764    797       SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr);
   765    798   
   766    799       int cur = -1;
   767    800       int unused;
   768    801       sqlite3_db_status(connection->db, SQLITE_DBSTATUS_LOOKASIDE_USED, &cur, &unused, 0);
................................................................................
   791    824   static JNINativeMethod sMethods[] =
   792    825   {
   793    826       /* name, signature, funcPtr */
   794    827       { "nativeOpen", "(Ljava/lang/String;ILjava/lang/String;ZZ)I",
   795    828               (void*)nativeOpen },
   796    829       { "nativeClose", "(I)V",
   797    830               (void*)nativeClose },
   798         -    { "nativeRegisterCustomFunction", "(ILandroid/database/sqlite/SQLiteCustomFunction;)V",
          831  +    { "nativeRegisterCustomFunction", "(ILorg/sqlite/database/sqlite/SQLiteCustomFunction;)V",
   799    832               (void*)nativeRegisterCustomFunction },
   800    833       { "nativeRegisterLocalizedCollators", "(ILjava/lang/String;)V",
   801    834               (void*)nativeRegisterLocalizedCollators },
   802    835       { "nativePrepareStatement", "(ILjava/lang/String;)I",
   803    836               (void*)nativePrepareStatement },
   804    837       { "nativeFinalizeStatement", "(II)V",
   805    838               (void*)nativeFinalizeStatement },
................................................................................
   855    888   
   856    889   #define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \
   857    890           var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \
   858    891           LOG_FATAL_IF(! var, "Unable to find field " fieldName);
   859    892   
   860    893   int register_android_database_SQLiteConnection(JNIEnv *env)
   861    894   {
          895  +#if 0
   862    896       jclass clazz;
   863    897       FIND_CLASS(clazz, "android/database/sqlite/SQLiteCustomFunction");
   864    898   
   865    899       GET_FIELD_ID(gSQLiteCustomFunctionClassInfo.name, clazz,
   866    900               "name", "Ljava/lang/String;");
   867    901       GET_FIELD_ID(gSQLiteCustomFunctionClassInfo.numArgs, clazz,
   868    902               "numArgs", "I");
   869    903       GET_METHOD_ID(gSQLiteCustomFunctionClassInfo.dispatchCallback,
   870    904               clazz, "dispatchCallback", "([Ljava/lang/String;)V");
   871    905   
   872    906       FIND_CLASS(clazz, "java/lang/String");
   873    907       gStringClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
   874    908   
   875         -    return AndroidRuntime::registerNativeMethods(env, "android/database/sqlite/SQLiteConnection",
   876         -            sMethods, NELEM(sMethods));
          909  +#endif
          910  +    return jniRegisterNativeMethods(env, 
          911  +        "org/sqlite/database/sqlite/SQLiteConnection",
          912  +        sMethods, NELEM(sMethods)
          913  +    );
   877    914   }
   878    915   
   879    916   } // namespace android
          917  +
          918  +extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
          919  +  JNIEnv *env = 0;
          920  +
          921  +  __android_log_print(ANDROID_LOG_INFO,  __FUNCTION__, "Loaded custom SQLite");
          922  +
          923  +  android::gpJavaVM = vm;
          924  +  vm->GetEnv((void**)&env, JNI_VERSION_1_4);
          925  +  android::register_android_database_SQLiteConnection(env);
          926  +
          927  +  return JNI_VERSION_1_4;
          928  +}
          929  +
          930  +
          931  +

Changes to jni/android_database_SQLiteDebug.cpp.

    78     78       GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.memoryUsed, clazz,
    79     79               "memoryUsed", "I");
    80     80       GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.largestMemAlloc, clazz,
    81     81               "largestMemAlloc", "I");
    82     82       GET_FIELD_ID(gSQLiteDebugPagerStatsClassInfo.pageCacheOverflow, clazz,
    83     83               "pageCacheOverflow", "I");
    84     84   
    85         -    return AndroidRuntime::registerNativeMethods(env, "android/database/sqlite/SQLiteDebug",
           85  +    return jniRegisterNativeMethods(env, "android/database/sqlite/SQLiteDebug",
    86     86               gMethods, NELEM(gMethods));
    87     87   }
    88     88   
    89     89   } // namespace android

Changes to jni/android_database_SQLiteGlobal.cpp.

    17     17   #define LOG_TAG "SQLiteGlobal"
    18     18   
    19     19   #include <jni.h>
    20     20   #include <JNIHelp.h>
    21     21   #include <android_runtime/AndroidRuntime.h>
    22     22   
    23     23   #include <sqlite3.h>
           24  +#if 0
    24     25   #include <sqlite3_android.h>
           26  +#endif
           27  +
    25     28   
    26     29   #include "android_database_SQLiteCommon.h"
    27     30   #include "android_util_Log.h"
    28     31   
    29     32   namespace android {
    30     33   
    31     34   // Limit heap to 8MB for now.  This is 4 times the maximum cursor window
................................................................................
    51     54   static void sqliteInitialize() {
    52     55       // Enable multi-threaded mode.  In this mode, SQLite is safe to use by multiple
    53     56       // threads as long as no two threads use the same database connection at the same
    54     57       // time (which we guarantee in the SQLite database wrappers).
    55     58       sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
    56     59   
    57     60       // Redirect SQLite log messages to the Android log.
           61  +#if 0
    58     62       bool verboseLog = android_util_Log_isVerboseLogEnabled(SQLITE_LOG_TAG);
           63  +#endif
           64  +    bool verboseLog = false;
    59     65       sqlite3_config(SQLITE_CONFIG_LOG, &sqliteLogCallback, verboseLog ? (void*)1 : NULL);
    60     66   
    61     67       // The soft heap limit prevents the page cache allocations from growing
    62     68       // beyond the given limit, no matter what the max page cache sizes are
    63     69       // set to. The limit does not, as of 3.5.0, affect any other allocations.
    64     70       sqlite3_soft_heap_limit(SOFT_HEAP_LIMIT);
    65     71   
................................................................................
    78     84               (void*)nativeReleaseMemory },
    79     85   };
    80     86   
    81     87   int register_android_database_SQLiteGlobal(JNIEnv *env)
    82     88   {
    83     89       sqliteInitialize();
    84     90   
    85         -    return AndroidRuntime::registerNativeMethods(env, "android/database/sqlite/SQLiteGlobal",
           91  +    return jniRegisterNativeMethods(env, "android/database/sqlite/SQLiteGlobal",
    86     92               sMethods, NELEM(sMethods));
    87     93   }
    88     94   
    89     95   } // namespace android

Changes to src/org/sqlite/database/CharArrayBuffer.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   /**
    20     20    * This is used for {@link Cursor#copyStringToBuffer}
    21     21    */
    22     22   public final class CharArrayBuffer {
    23     23       public CharArrayBuffer(int size) {
    24     24           data = new char[size];

Changes to src/org/sqlite/database/DataSetObservable.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   /**
    20     20    * A specialization of {@link Observable} for {@link DataSetObserver}
    21     21    * that provides methods for sending notifications to a list of
    22     22    * {@link DataSetObserver} objects.
    23     23    */
    24     24   public class DataSetObservable extends Observable<DataSetObserver> {

Changes to src/org/sqlite/database/DataSetObserver.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   /**
    20     20    * Receives call backs when a data set has been changed, or made invalid. The typically data sets
    21     21    * that are observed are {@link Cursor}s or {@link android.widget.Adapter}s.
    22     22    * DataSetObserver must be implemented by objects which are added to a DataSetObservable.
    23     23    */
    24     24   public abstract class DataSetObserver {

Changes to src/org/sqlite/database/DatabaseErrorHandler.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19         -import android.database.sqlite.SQLiteDatabase;
           19  +import org.sqlite.database.sqlite.SQLiteDatabase;
    20     20   
    21     21   /**
    22     22    * An interface to let the apps define the actions to take when the following errors are detected
    23     23    *   database corruption
    24     24    */
    25     25   public interface DatabaseErrorHandler {
    26     26   

Changes to src/org/sqlite/database/DefaultDatabaseErrorHandler.java.

     9      9    *
    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16         -package android.database;
           16  +package org.sqlite.database;
    17     17   
    18     18   import java.io.File;
    19     19   import java.util.List;
    20     20   
    21         -import android.database.sqlite.SQLiteDatabase;
    22         -import android.database.sqlite.SQLiteException;
           21  +import org.sqlite.database.sqlite.SQLiteDatabase;
           22  +import org.sqlite.database.sqlite.SQLiteException;
    23     23   import android.util.Log;
    24     24   import android.util.Pair;
    25     25   
    26     26   /**
    27     27    * Default class used to define the actions to take when the database corruption is reported
    28     28    * by sqlite.
    29     29    * <p>
    30     30    * An application can specify an implementation of {@link DatabaseErrorHandler} on the
    31     31    * following:
    32     32    * <ul>
    33     33    *   <li>{@link SQLiteDatabase#openOrCreateDatabase(String,
    34         - *      android.database.sqlite.SQLiteDatabase.CursorFactory, DatabaseErrorHandler)}</li>
           34  + *      org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory, DatabaseErrorHandler)}</li>
    35     35    *   <li>{@link SQLiteDatabase#openDatabase(String,
    36         - *      android.database.sqlite.SQLiteDatabase.CursorFactory, int, DatabaseErrorHandler)}</li>
           36  + *      org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory, int, DatabaseErrorHandler)}</li>
    37     37    * </ul>
    38     38    * The specified {@link DatabaseErrorHandler} is used to handle database corruption errors, if they
    39     39    * occur.
    40     40    * <p>
    41     41    * If null is specified for DatabaeErrorHandler param in the above calls, then this class is used
    42     42    * as the default {@link DatabaseErrorHandler}.
    43     43    */

Changes to src/org/sqlite/database/IContentObserver.aidl.

    11     11   ** Unless required by applicable law or agreed to in writing, software 
    12     12   ** distributed under the License is distributed on an "AS IS" BASIS, 
    13     13   ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    14     14   ** See the License for the specific language governing permissions and 
    15     15   ** limitations under the License.
    16     16   */
    17     17   
    18         -package android.database;
           18  +package org.sqlite.database;
    19     19   
    20     20   import android.net.Uri;
    21     21   
    22     22   /**
    23     23    * @hide
    24     24    */
    25     25   interface IContentObserver

Changes to src/org/sqlite/database/Observable.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   import java.util.ArrayList;
    20     20   
    21     21   /**
    22     22    * Provides methods for registering or unregistering arbitrary observers in an {@link ArrayList}.
    23     23    *
    24     24    * This abstract class is intended to be subclassed and specialized to maintain

Changes to src/org/sqlite/database/SQLException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   /**
    20     20    * An exception that indicates there was an error with SQL parsing or execution.
    21     21    */
    22     22   public class SQLException extends RuntimeException {
    23     23       public SQLException() {
    24     24       }

Changes to src/org/sqlite/database/StaleDataException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database;
           17  +package org.sqlite.database;
    18     18   
    19     19   /**
    20     20    * This exception is thrown when a Cursor contains stale data and must be
    21     21    * requeried before being used again.
    22     22    */
    23     23   public class StaleDataException extends java.lang.RuntimeException
    24     24   {

Changes to src/org/sqlite/database/sqlite/CloseGuard.java.

   220    220       }
   221    221   
   222    222       /**
   223    223        * Default Reporter which reports CloseGuard violations to the log.
   224    224        */
   225    225       private static final class DefaultReporter implements Reporter {
   226    226           @Override public void report (String message, Throwable allocationSite) {
   227         -            System.logW(message, allocationSite);
          227  +            /* System.logW(message, allocationSite); */
   228    228           }
   229    229       }
   230    230   }

Changes to src/org/sqlite/database/sqlite/DatabaseObjectNotClosedException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that garbage-collector is finalizing a database object
    21     21    * that is not explicitly closed
    22     22    * @hide
    23     23    */
    24     24   public class DatabaseObjectNotClosedException extends RuntimeException {

Added src/org/sqlite/database/sqlite/ExtraUtils.java.

            1  +/*
            2  + * Copyright (C) 2006 The Android Open Source Project
            3  + *
            4  + * Licensed under the Apache License, Version 2.0 (the "License");
            5  + * you may not use this file except in compliance with the License.
            6  + * You may obtain a copy of the License at
            7  + *
            8  + *      http://www.apache.org/licenses/LICENSE-2.0
            9  + *
           10  + * Unless required by applicable law or agreed to in writing, software
           11  + * distributed under the License is distributed on an "AS IS" BASIS,
           12  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           13  + * See the License for the specific language governing permissions and
           14  + * limitations under the License.
           15  + */
           16  +
           17  +package org.sqlite.database;
           18  +import android.database.Cursor;
           19  +import android.database.CursorWindow;
           20  +
           21  +/* import org.apache.commons.codec.binary.Hex; */
           22  +
           23  +import android.content.ContentValues;
           24  +import android.content.Context;
           25  +import android.content.OperationApplicationException;
           26  +import org.sqlite.database.sqlite.SQLiteAbortException;
           27  +import org.sqlite.database.sqlite.SQLiteConstraintException;
           28  +import org.sqlite.database.sqlite.SQLiteDatabase;
           29  +import org.sqlite.database.sqlite.SQLiteDatabaseCorruptException;
           30  +import org.sqlite.database.sqlite.SQLiteDiskIOException;
           31  +import org.sqlite.database.sqlite.SQLiteException;
           32  +import org.sqlite.database.sqlite.SQLiteFullException;
           33  +import org.sqlite.database.sqlite.SQLiteProgram;
           34  +import org.sqlite.database.sqlite.SQLiteStatement;
           35  +import android.os.OperationCanceledException;
           36  +import android.os.Parcel;
           37  +import android.os.ParcelFileDescriptor;
           38  +import android.text.TextUtils;
           39  +import android.util.Log;
           40  +
           41  +import java.io.FileNotFoundException;
           42  +import java.io.PrintStream;
           43  +import java.text.Collator;
           44  +import java.util.HashMap;
           45  +import java.util.Locale;
           46  +import java.util.Map;
           47  +
           48  +/**
           49  + * Static utility methods for dealing with databases and {@link Cursor}s.
           50  + */
           51  +public class ExtraUtils {
           52  +    private static final String TAG = "ExtraUtils";
           53  +
           54  +    private static final boolean DEBUG = false;
           55  +
           56  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           57  +    public static final int STATEMENT_SELECT = 1;
           58  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           59  +    public static final int STATEMENT_UPDATE = 2;
           60  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           61  +    public static final int STATEMENT_ATTACH = 3;
           62  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           63  +    public static final int STATEMENT_BEGIN = 4;
           64  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           65  +    public static final int STATEMENT_COMMIT = 5;
           66  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           67  +    public static final int STATEMENT_ABORT = 6;
           68  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           69  +    public static final int STATEMENT_PRAGMA = 7;
           70  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           71  +    public static final int STATEMENT_DDL = 8;
           72  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           73  +    public static final int STATEMENT_UNPREPARED = 9;
           74  +    /** One of the values returned by {@link #getSqlStatementType(String)}. */
           75  +    public static final int STATEMENT_OTHER = 99;
           76  +
           77  +    /**
           78  +     * Returns column index of "_id" column, or -1 if not found.
           79  +     */
           80  +    public static int findRowIdColumnIndex(String[] columnNames) {
           81  +        int length = columnNames.length;
           82  +        for (int i = 0; i < length; i++) {
           83  +            if (columnNames[i].equals("_id")) {
           84  +                return i;
           85  +            }
           86  +        }
           87  +        return -1;
           88  +    }
           89  +}

Changes to src/org/sqlite/database/sqlite/SQLiteAbortException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that the SQLite program was aborted.
    21     21    * This can happen either through a call to ABORT in a trigger,
    22     22    * or as the result of using the ABORT conflict clause.
    23     23    */
    24     24   public class SQLiteAbortException extends SQLiteException {
    25     25       public SQLiteAbortException() {}
    26     26   
    27     27       public SQLiteAbortException(String error) {
    28     28           super(error);
    29     29       }
    30     30   }

Changes to src/org/sqlite/database/sqlite/SQLiteAccessPermException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * This exception class is used when sqlite can't access the database file
    21     21    * due to lack of permissions on the file.
    22     22    */
    23     23   public class SQLiteAccessPermException extends SQLiteException {
    24     24       public SQLiteAccessPermException() {}
    25     25   
    26     26       public SQLiteAccessPermException(String error) {
    27     27           super(error);
    28     28       }
    29     29   }

Changes to src/org/sqlite/database/sqlite/SQLiteBindOrColumnIndexOutOfRangeException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * Thrown if the the bind or column parameter index is out of range
    21     21    */
    22     22   public class SQLiteBindOrColumnIndexOutOfRangeException extends SQLiteException {
    23     23       public SQLiteBindOrColumnIndexOutOfRangeException() {}
    24     24   
    25     25       public SQLiteBindOrColumnIndexOutOfRangeException(String error) {
    26     26           super(error);
    27     27       }
    28     28   }

Changes to src/org/sqlite/database/sqlite/SQLiteBlobTooBigException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteBlobTooBigException extends SQLiteException {
    20     20       public SQLiteBlobTooBigException() {}
    21     21   
    22     22       public SQLiteBlobTooBigException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteCantOpenDatabaseException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteCantOpenDatabaseException extends SQLiteException {
    20     20       public SQLiteCantOpenDatabaseException() {}
    21     21   
    22     22       public SQLiteCantOpenDatabaseException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteClosable.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import java.io.Closeable;
    20     20   
    21     21   /**
    22     22    * An object created from a SQLiteDatabase that can be closed.
    23     23    *
    24     24    * This class implements a primitive reference counting scheme for database objects.

Changes to src/org/sqlite/database/sqlite/SQLiteConnection.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19         -import dalvik.system.BlockGuard;
           19  +/* import dalvik.system.BlockGuard; */
    20     20   import dalvik.system.CloseGuard;
    21     21   
    22     22   import android.database.Cursor;
    23     23   import android.database.CursorWindow;
    24     24   import android.database.DatabaseUtils;
    25         -import android.database.sqlite.SQLiteDebug.DbStats;
           25  +import org.sqlite.database.sqlite.SQLiteDebug.DbStats;
    26     26   import android.os.CancellationSignal;
    27     27   import android.os.OperationCanceledException;
    28     28   import android.os.ParcelFileDescriptor;
    29     29   import android.util.Log;
    30     30   import android.util.LruCache;
    31     31   import android.util.Printer;
    32     32   
................................................................................
   415    415                   & SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING) != 0;
   416    416           boolean localeChanged = !configuration.locale.equals(mConfiguration.locale);
   417    417   
   418    418           // Update configuration parameters.
   419    419           mConfiguration.updateParametersFrom(configuration);
   420    420   
   421    421           // Update prepared statement cache size.
   422         -        mPreparedStatementCache.resize(configuration.maxSqlCacheSize);
          422  +        /* mPreparedStatementCache.resize(configuration.maxSqlCacheSize); */
   423    423   
   424    424           // Update foreign key mode.
   425    425           if (foreignKeyModeChanged) {
   426    426               setForeignKeyModeFromConfiguration();
   427    427           }
   428    428   
   429    429           // Update WAL.
................................................................................
   816    816        * @throws SQLiteException if an error occurs, such as a syntax error
   817    817        * or invalid number of bind arguments.
   818    818        * @throws OperationCanceledException if the operation was canceled.
   819    819        */
   820    820       public int executeForCursorWindow(String sql, Object[] bindArgs,
   821    821               CursorWindow window, int startPos, int requiredPos, boolean countAllRows,
   822    822               CancellationSignal cancellationSignal) {
          823  +      /*
   823    824           if (sql == null) {
   824    825               throw new IllegalArgumentException("sql must not be null.");
   825    826           }
   826    827           if (window == null) {
   827    828               throw new IllegalArgumentException("window must not be null.");
   828    829           }
   829    830   
................................................................................
   867    868                               + ", filledRows=" + filledRows
   868    869                               + ", countedRows=" + countedRows);
   869    870                   }
   870    871               }
   871    872           } finally {
   872    873               window.releaseReference();
   873    874           }
          875  +   */
          876  +      return -1;
   874    877       }
   875    878   
   876    879       private PreparedStatement acquirePreparedStatement(String sql) {
   877    880           PreparedStatement statement = mPreparedStatementCache.get(sql);
   878    881           boolean skipCache = false;
   879    882           if (statement != null) {
   880    883               if (!statement.mInUse) {
................................................................................
   971    974       // However, it will only be called between calls to attachCancellationSignal and
   972    975       // detachCancellationSignal, while a statement is executing.  We can safely assume
   973    976       // that the SQLite connection is still alive.
   974    977       @Override
   975    978       public void onCancel() {
   976    979           nativeCancel(mConnectionPtr);
   977    980       }
          981  +
          982  +    private static int databaseutils_getTypeOfObject(Object obj) {
          983  +        if (obj == null) {
          984  +            return Cursor.FIELD_TYPE_NULL;
          985  +        } else if (obj instanceof byte[]) {
          986  +            return Cursor.FIELD_TYPE_BLOB;
          987  +        } else if (obj instanceof Float || obj instanceof Double) {
          988  +            return Cursor.FIELD_TYPE_FLOAT;
          989  +        } else if (obj instanceof Long || obj instanceof Integer
          990  +                || obj instanceof Short || obj instanceof Byte) {
          991  +            return Cursor.FIELD_TYPE_INTEGER;
          992  +        } else {
          993  +            return Cursor.FIELD_TYPE_STRING;
          994  +        }
          995  +    }
   978    996   
   979    997       private void bindArguments(PreparedStatement statement, Object[] bindArgs) {
   980    998           final int count = bindArgs != null ? bindArgs.length : 0;
   981    999           if (count != statement.mNumParameters) {
   982   1000               throw new SQLiteBindOrColumnIndexOutOfRangeException(
   983   1001                       "Expected " + statement.mNumParameters + " bind arguments but "
   984   1002                       + count + " were provided.");
................................................................................
   986   1004           if (count == 0) {
   987   1005               return;
   988   1006           }
   989   1007   
   990   1008           final int statementPtr = statement.mStatementPtr;
   991   1009           for (int i = 0; i < count; i++) {
   992   1010               final Object arg = bindArgs[i];
   993         -            switch (DatabaseUtils.getTypeOfObject(arg)) {
         1011  +            switch (databaseutils_getTypeOfObject(arg)) {
   994   1012                   case Cursor.FIELD_TYPE_NULL:
   995   1013                       nativeBindNull(mConnectionPtr, statementPtr, i + 1);
   996   1014                       break;
   997   1015                   case Cursor.FIELD_TYPE_INTEGER:
   998   1016                       nativeBindLong(mConnectionPtr, statementPtr, i + 1,
   999   1017                               ((Number)arg).longValue());
  1000   1018                       break;
................................................................................
  1032   1050                   || statementType == DatabaseUtils.STATEMENT_SELECT) {
  1033   1051               return true;
  1034   1052           }
  1035   1053           return false;
  1036   1054       }
  1037   1055   
  1038   1056       private void applyBlockGuardPolicy(PreparedStatement statement) {
  1039         -        if (!mConfiguration.isInMemoryDb()) {
  1040         -            if (statement.mReadOnly) {
  1041         -                BlockGuard.getThreadPolicy().onReadFromDisk();
  1042         -            } else {
  1043         -                BlockGuard.getThreadPolicy().onWriteToDisk();
  1044         -            }
  1045         -        }
         1057  +/*        if (!mConfiguration.isInMemoryDb()) {*/
         1058  +/*            if (statement.mReadOnly) {*/
         1059  +/*                BlockGuard.getThreadPolicy().onReadFromDisk();*/
         1060  +/*            } else {*/
         1061  +/*                BlockGuard.getThreadPolicy().onWriteToDisk();*/
         1062  +/*            }*/
         1063  +/*        }*/
  1046   1064       }
  1047   1065   
  1048   1066       /**
  1049   1067        * Dumps debugging information about this connection.
  1050   1068        *
  1051   1069        * @param printer The printer to receive the dump, not null.
  1052   1070        * @param verbose True to dump more verbose information.

Changes to src/org/sqlite/database/sqlite/SQLiteConnectionPool.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import dalvik.system.CloseGuard;
    20     20   
    21         -import android.database.sqlite.SQLiteDebug.DbStats;
           21  +import org.sqlite.database.sqlite.SQLiteDebug.DbStats;
    22     22   import android.os.CancellationSignal;
    23     23   import android.os.OperationCanceledException;
    24     24   import android.os.SystemClock;
    25     25   import android.util.Log;
    26         -import android.util.PrefixPrinter;
           26  +/* import android.util.PrefixPrinter; */
    27     27   import android.util.Printer;
    28     28   
    29     29   import java.io.Closeable;
    30     30   import java.util.ArrayList;
    31     31   import java.util.Map;
    32     32   import java.util.WeakHashMap;
    33     33   import java.util.concurrent.atomic.AtomicBoolean;
................................................................................
   995    995       /**
   996    996        * Dumps debugging information about this connection pool.
   997    997        *
   998    998        * @param printer The printer to receive the dump, not null.
   999    999        * @param verbose True to dump more verbose information.
  1000   1000        */
  1001   1001       public void dump(Printer printer, boolean verbose) {
  1002         -        Printer indentedPrinter = PrefixPrinter.create(printer, "    ");
         1002  +      /*
         1003  +        Printer indentedPrinter = Printer.create(printer, "    ");
  1003   1004           synchronized (mLock) {
  1004   1005               printer.println("Connection pool for " + mConfiguration.path + ":");
  1005   1006               printer.println("  Open: " + mIsOpen);
  1006   1007               printer.println("  Max connections: " + mMaxConnectionPoolSize);
  1007   1008   
  1008   1009               printer.println("  Available primary connection:");
  1009   1010               if (mAvailablePrimaryConnection != null) {
................................................................................
  1046   1047                               + ", priority=" + waiter.mPriority
  1047   1048                               + ", sql='" + waiter.mSql + "'");
  1048   1049                   }
  1049   1050               } else {
  1050   1051                   indentedPrinter.println("<none>");
  1051   1052               }
  1052   1053           }
         1054  +        */
  1053   1055       }
  1054   1056   
  1055   1057       @Override
  1056   1058       public String toString() {
  1057   1059           return "SQLiteConnectionPool: " + mConfiguration.path;
  1058   1060       }
  1059   1061   

Changes to src/org/sqlite/database/sqlite/SQLiteConstraintException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that an integrity constraint was violated.
    21     21    */
    22     22   public class SQLiteConstraintException extends SQLiteException {
    23     23       public SQLiteConstraintException() {}
    24     24   
    25     25       public SQLiteConstraintException(String error) {
    26     26           super(error);
    27     27       }
    28     28   }

Changes to src/org/sqlite/database/sqlite/SQLiteCursor.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
           18  +
           19  +import org.sqlite.database.ExtraUtils;
    18     20   
    19     21   import android.database.AbstractWindowedCursor;
    20     22   import android.database.CursorWindow;
           23  +
    21     24   import android.database.DatabaseUtils;
    22     25   import android.os.StrictMode;
    23     26   import android.util.Log;
    24     27   
    25     28   import java.util.HashMap;
    26     29   import java.util.Map;
    27     30   
................................................................................
    90     93        * @param editTable the name of the table used for this query
    91     94        * @param query the {@link SQLiteQuery} object associated with this cursor object.
    92     95        */
    93     96       public SQLiteCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query) {
    94     97           if (query == null) {
    95     98               throw new IllegalArgumentException("query object cannot be null");
    96     99           }
    97         -        if (StrictMode.vmSqliteObjectLeaksEnabled()) {
          100  +        if (/* StrictMode.vmSqliteObjectLeaksEnabled() */ false ) {
    98    101               mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
    99    102           } else {
   100    103               mStackTrace = null;
   101    104           }
   102    105           mDriver = driver;
   103    106           mEditTable = editTable;
   104    107           mColumnNameMap = null;
   105    108           mQuery = query;
   106    109   
   107    110           mColumns = query.getColumnNames();
   108         -        mRowIdColumnIndex = DatabaseUtils.findRowIdColumnIndex(mColumns);
          111  +        mRowIdColumnIndex = ExtraUtils.findRowIdColumnIndex(mColumns);
   109    112       }
   110    113   
   111    114       /**
   112    115        * Get the database that this cursor is associated with.
   113    116        * @return the SQLiteDatabase that this cursor is associated with.
   114    117        */
   115    118       public SQLiteDatabase getDatabase() {
................................................................................
   132    135           if (mCount == NO_COUNT) {
   133    136               fillWindow(0);
   134    137           }
   135    138           return mCount;
   136    139       }
   137    140   
   138    141       private void fillWindow(int requiredPos) {
          142  +      /*
   139    143           clearOrCreateWindow(getDatabase().getPath());
   140    144   
   141    145           try {
   142    146               if (mCount == NO_COUNT) {
   143    147                   int startPos = DatabaseUtils.cursorPickFillWindowStartPosition(requiredPos, 0);
   144    148                   mCount = mQuery.fillWindow(mWindow, startPos, requiredPos, true);
   145    149                   mCursorWindowCapacity = mWindow.getNumRows();
................................................................................
   155    159               // Close the cursor window if the query failed and therefore will
   156    160               // not produce any results.  This helps to avoid accidentally leaking
   157    161               // the cursor window if the client does not correctly handle exceptions
   158    162               // and fails to close the cursor.
   159    163               closeWindow();
   160    164               throw ex;
   161    165           }
          166  +        */
   162    167       }
   163    168   
   164    169       @Override
   165    170       public int getColumnIndex(String columnName) {
   166    171           // Create mColumnNameMap on demand
   167    172           if (mColumnNameMap == null) {
   168    173               String[] columns = mColumns;
................................................................................
   256    261        * Release the native resources, if they haven't been released yet.
   257    262        */
   258    263       @Override
   259    264       protected void finalize() {
   260    265           try {
   261    266               // if the cursor hasn't been closed yet, close it first
   262    267               if (mWindow != null) {
          268  +                    /*
   263    269                   if (mStackTrace != null) {
   264    270                       String sql = mQuery.getSql();
   265    271                       int len = sql.length();
   266    272                       StrictMode.onSqliteObjectLeaked(
   267    273                           "Finalizing a Cursor that has not been deactivated or closed. " +
   268    274                           "database = " + mQuery.getDatabase().getLabel() +
   269    275                           ", table = " + mEditTable +
   270    276                           ", query = " + sql.substring(0, (len > 1000) ? 1000 : len),
   271    277                           mStackTrace);
   272    278                   }
          279  +                */
   273    280                   close();
   274    281               }
   275    282           } finally {
   276    283               super.finalize();
   277    284           }
   278    285       }
   279    286   }

Changes to src/org/sqlite/database/sqlite/SQLiteCursorDriver.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.Cursor;
    20         -import android.database.sqlite.SQLiteDatabase.CursorFactory;
           20  +import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
    21     21   
    22     22   /**
    23     23    * A driver for SQLiteCursors that is used to create them and gets notified
    24     24    * by the cursors it creates on significant events in their lifetimes.
    25     25    */
    26     26   public interface SQLiteCursorDriver {
    27     27       /**

Changes to src/org/sqlite/database/sqlite/SQLiteCustomFunction.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * Describes a custom SQL function.
    21     21    *
    22     22    * @hide
    23     23    */
    24     24   public final class SQLiteCustomFunction {

Changes to src/org/sqlite/database/sqlite/SQLiteDatabase.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.content.ContentValues;
    20     20   import android.database.Cursor;
    21         -import android.database.DatabaseErrorHandler;
           21  +import org.sqlite.database.DatabaseErrorHandler;
    22     22   import android.database.DatabaseUtils;
    23         -import android.database.DefaultDatabaseErrorHandler;
    24         -import android.database.SQLException;
    25         -import android.database.sqlite.SQLiteDebug.DbStats;
           23  +import org.sqlite.database.DefaultDatabaseErrorHandler;
           24  +import org.sqlite.database.SQLException;
           25  +import org.sqlite.database.sqlite.SQLiteDebug.DbStats;
    26     26   import android.os.CancellationSignal;
    27     27   import android.os.Looper;
    28     28   import android.os.OperationCanceledException;
    29     29   import android.text.TextUtils;
    30     30   import android.util.EventLog;
    31     31   import android.util.Log;
    32     32   import android.util.Pair;
................................................................................
   848    848                   mConnectionPoolLocked.reconfigure(mConfigurationLocked);
   849    849               } catch (RuntimeException ex) {
   850    850                   mConfigurationLocked.customFunctions.remove(wrapper);
   851    851                   throw ex;
   852    852               }
   853    853           }
   854    854       }
          855  +
          856  +    /**
          857  +     * Utility method to run the query on the db and return the value in the
          858  +     * first column of the first row.
          859  +     */
          860  +    private static long databaseutils_longForQuery(
          861  +        SQLiteDatabase db, String query, String[] selectionArgs
          862  +    ) {
          863  +        SQLiteStatement prog = db.compileStatement(query);
          864  +        try {
          865  +            return databaseutils_longForQuery(prog, selectionArgs);
          866  +        } finally {
          867  +            prog.close();
          868  +        }
          869  +    }
          870  +
          871  +    /**
          872  +     * Utility method to run the pre-compiled query and return the value in the
          873  +     * first column of the first row.
          874  +     */
          875  +    private static long databaseutils_longForQuery(
          876  +        SQLiteStatement prog, String[] selectionArgs
          877  +    ) {
          878  +        prog.bindAllArgsAsStrings(selectionArgs);
          879  +        return prog.simpleQueryForLong();
          880  +    }
   855    881   
   856    882       /**
   857    883        * Gets the database version.
   858    884        *
   859    885        * @return the database version
   860    886        */
   861    887       public int getVersion() {
   862         -        return ((Long) DatabaseUtils.longForQuery(this, "PRAGMA user_version;", null)).intValue();
          888  +        return ((Long) databaseutils_longForQuery(this, "PRAGMA user_version;", null)).intValue();
   863    889       }
   864    890   
   865    891       /**
   866    892        * Sets the database version.
   867    893        *
   868    894        * @param version the new database version
   869    895        */
................................................................................
   873    899   
   874    900       /**
   875    901        * Returns the maximum size the database may grow to.
   876    902        *
   877    903        * @return the new maximum database size
   878    904        */
   879    905       public long getMaximumSize() {
   880         -        long pageCount = DatabaseUtils.longForQuery(this, "PRAGMA max_page_count;", null);
          906  +        long pageCount = databaseutils_longForQuery(this, "PRAGMA max_page_count;", null);
   881    907           return pageCount * getPageSize();
   882    908       }
   883    909   
   884    910       /**
   885    911        * Sets the maximum size the database will grow to. The maximum size cannot
   886    912        * be set below the current size.
   887    913        *
................................................................................
   891    917       public long setMaximumSize(long numBytes) {
   892    918           long pageSize = getPageSize();
   893    919           long numPages = numBytes / pageSize;
   894    920           // If numBytes isn't a multiple of pageSize, bump up a page
   895    921           if ((numBytes % pageSize) != 0) {
   896    922               numPages++;
   897    923           }
   898         -        long newPageCount = DatabaseUtils.longForQuery(this, "PRAGMA max_page_count = " + numPages,
          924  +        long newPageCount = databaseutils_longForQuery(this, "PRAGMA max_page_count = " + numPages,
   899    925                   null);
   900    926           return newPageCount * pageSize;
   901    927       }
   902    928   
   903    929       /**
   904    930        * Returns the current database page size, in bytes.
   905    931        *
   906    932        * @return the database page size, in bytes
   907    933        */
   908    934       public long getPageSize() {
   909         -        return DatabaseUtils.longForQuery(this, "PRAGMA page_size;", null);
          935  +        return databaseutils_longForQuery(this, "PRAGMA page_size;", null);
   910    936       }
   911    937   
   912    938       /**
   913    939        * Sets the database page size. The page size must be a power of two. This
   914    940        * method does not work if any data has been written to the database file,
   915    941        * and must be called right after the database has been created.
   916    942        *

Changes to src/org/sqlite/database/sqlite/SQLiteDatabaseConfiguration.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import java.util.ArrayList;
    20     20   import java.util.Locale;
    21     21   import java.util.regex.Pattern;
    22     22   
    23     23   /**
    24     24    * Describes how to configure a database.

Changes to src/org/sqlite/database/sqlite/SQLiteDatabaseCorruptException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that the SQLite database file is corrupt.
    21     21    */
    22     22   public class SQLiteDatabaseCorruptException extends SQLiteException {
    23     23       public SQLiteDatabaseCorruptException() {}
    24     24   
    25     25       public SQLiteDatabaseCorruptException(String error) {
    26     26           super(error);
    27     27       }
    28     28   }

Changes to src/org/sqlite/database/sqlite/SQLiteDatabaseLockedException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * Thrown if  the database engine was unable to acquire the
    21     21    * database locks it needs to do its job.  If the statement is a [COMMIT]
    22     22    * or occurs outside of an explicit transaction, then you can retry the
    23     23    * statement.  If the statement is not a [COMMIT] and occurs within a
    24     24    * explicit transaction then you should rollback the transaction before

Changes to src/org/sqlite/database/sqlite/SQLiteDatatypeMismatchException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteDatatypeMismatchException extends SQLiteException {
    20     20       public SQLiteDatatypeMismatchException() {}
    21     21   
    22     22       public SQLiteDatatypeMismatchException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteDebug.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import java.util.ArrayList;
    20     20   
    21     21   import android.os.Build;
    22         -import android.os.SystemProperties;
           22  +/* import android.os.SystemProperties; */
    23     23   import android.util.Log;
    24     24   import android.util.Printer;
    25     25   
    26     26   /**
    27     27    * Provides debugging info about all SQLite databases running in the current process.
    28     28    *
    29     29    * {@hide}
................................................................................
    56     56       public static final boolean DEBUG_SQL_TIME =
    57     57               Log.isLoggable("SQLiteTime", Log.VERBOSE);
    58     58   
    59     59       /**
    60     60        * True to enable database performance testing instrumentation.
    61     61        * @hide
    62     62        */
    63         -    public static final boolean DEBUG_LOG_SLOW_QUERIES = Build.IS_DEBUGGABLE;
           63  +    public static final boolean DEBUG_LOG_SLOW_QUERIES = false;
    64     64   
    65     65       private SQLiteDebug() {
    66     66       }
    67     67   
    68     68       /**
    69     69        * Determines whether a query should be logged.
    70     70        *
................................................................................
    75     75        *
    76     76        * This value can be changed dynamically while the system is running.
    77     77        * For example, "adb shell setprop db.log.slow_query_threshold 200" will
    78     78        * log all queries that take 200ms or longer to run.
    79     79        * @hide
    80     80        */
    81     81       public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) {
    82         -        int slowQueryMillis = SystemProperties.getInt("db.log.slow_query_threshold", -1);
           82  +        int slowQueryMillis = 10000;
    83     83           return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis;
    84     84       }
    85     85   
    86     86       /**
    87     87        * Contains statistics about the active pagers in the current process.
    88     88        *
    89     89        * @see #nativeGetPagerStats(PagerStats)

Changes to src/org/sqlite/database/sqlite/SQLiteDirectCursorDriver.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.Cursor;
    20         -import android.database.sqlite.SQLiteDatabase.CursorFactory;
           20  +import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
    21     21   import android.os.CancellationSignal;
    22     22   
    23     23   /**
    24     24    * A cursor driver that uses the given query directly.
    25     25    * 
    26     26    * @hide
    27     27    */

Changes to src/org/sqlite/database/sqlite/SQLiteDiskIOException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that an IO error occured while accessing the 
    21     21    * SQLite database file.
    22     22    */
    23     23   public class SQLiteDiskIOException extends SQLiteException {
    24     24       public SQLiteDiskIOException() {}
    25     25   
    26     26       public SQLiteDiskIOException(String error) {
    27     27           super(error);
    28     28       }
    29     29   }

Changes to src/org/sqlite/database/sqlite/SQLiteDoneException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that the SQLite program is done.
    21     21    * Thrown when an operation that expects a row (such as {@link
    22     22    * SQLiteStatement#simpleQueryForString} or {@link
    23     23    * SQLiteStatement#simpleQueryForLong}) does not get one.
    24     24    */

Changes to src/org/sqlite/database/sqlite/SQLiteException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19         -import android.database.SQLException;
           19  +import org.sqlite.database.SQLException;
    20     20   
    21     21   /**
    22     22    * A SQLite exception that indicates there was an error with SQL parsing or execution.
    23     23    */
    24     24   public class SQLiteException extends SQLException {
    25     25       public SQLiteException() {
    26     26       }

Changes to src/org/sqlite/database/sqlite/SQLiteFullException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * An exception that indicates that the SQLite database is full.
    21     21    */
    22     22   public class SQLiteFullException extends SQLiteException {
    23     23       public SQLiteFullException() {}
    24     24   
    25     25       public SQLiteFullException(String error) {
    26     26           super(error);
    27     27       }
    28     28   }

Changes to src/org/sqlite/database/sqlite/SQLiteGlobal.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.content.res.Resources;
    20     20   import android.os.StatFs;
    21         -import android.os.SystemProperties;
           21  +/* import android.os.SystemProperties; */
    22     22   
    23     23   /**
    24     24    * Provides access to SQLite functions that affect all database connection,
    25     25    * such as memory management.
    26     26    *
    27     27    * The native code associated with SQLiteGlobal is also sets global configuration options
    28     28    * using sqlite3_config() then calls sqlite3_initialize() to ensure that the SQLite
................................................................................
    59     59        * Gets the default page size to use when creating a database.
    60     60        */
    61     61       public static int getDefaultPageSize() {
    62     62           synchronized (sLock) {
    63     63               if (sDefaultPageSize == 0) {
    64     64                   sDefaultPageSize = new StatFs("/data").getBlockSize();
    65     65               }
    66         -            return SystemProperties.getInt("debug.sqlite.pagesize", sDefaultPageSize);
           66  +            return 1024;
    67     67           }
    68     68       }
    69     69   
    70     70       /**
    71     71        * Gets the default journal mode when WAL is not in use.
    72     72        */
    73     73       public static String getDefaultJournalMode() {
    74         -        return SystemProperties.get("debug.sqlite.journalmode",
    75         -                Resources.getSystem().getString(
    76         -                com.android.internal.R.string.db_default_journal_mode));
           74  +        return "delete";
    77     75       }
    78     76   
    79     77       /**
    80     78        * Gets the journal size limit in bytes.
    81     79        */
    82     80       public static int getJournalSizeLimit() {
    83         -        return SystemProperties.getInt("debug.sqlite.journalsizelimit",
    84         -                Resources.getSystem().getInteger(
    85         -                com.android.internal.R.integer.db_journal_size_limit));
           81  +        return 10000;
    86     82       }
    87     83   
    88     84       /**
    89     85        * Gets the default database synchronization mode when WAL is not in use.
    90     86        */
    91     87       public static String getDefaultSyncMode() {
    92         -        return SystemProperties.get("debug.sqlite.syncmode",
    93         -                Resources.getSystem().getString(
    94         -                com.android.internal.R.string.db_default_sync_mode));
           88  +        return "normal";
    95     89       }
    96     90   
    97     91       /**
    98     92        * Gets the database synchronization mode when in WAL mode.
    99     93        */
   100     94       public static String getWALSyncMode() {
   101         -        return SystemProperties.get("debug.sqlite.wal.syncmode",
   102         -                Resources.getSystem().getString(
   103         -                com.android.internal.R.string.db_wal_sync_mode));
           95  +        return "normal";
   104     96       }
   105     97   
   106     98       /**
   107     99        * Gets the WAL auto-checkpoint integer in database pages.
   108    100        */
   109    101       public static int getWALAutoCheckpoint() {
   110         -        int value = SystemProperties.getInt("debug.sqlite.wal.autocheckpoint",
   111         -                Resources.getSystem().getInteger(
   112         -                com.android.internal.R.integer.db_wal_autocheckpoint));
          102  +        int value = 1000;
   113    103           return Math.max(1, value);
   114    104       }
   115    105   
   116    106       /**
   117    107        * Gets the connection pool size when in WAL mode.
   118    108        */
   119    109       public static int getWALConnectionPoolSize() {
   120         -        int value = SystemProperties.getInt("debug.sqlite.wal.poolsize",
   121         -                Resources.getSystem().getInteger(
   122         -                com.android.internal.R.integer.db_connection_pool_size));
          110  +        int value = 10;
   123    111           return Math.max(2, value);
   124    112       }
   125    113   }

Changes to src/org/sqlite/database/sqlite/SQLiteMisuseException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * This error can occur if the application creates a SQLiteStatement object and allows multiple
    21     21    * threads in the application use it at the same time.
    22     22    * Sqlite returns this error if bind and execute methods on this object occur at the same time
    23     23    * from multiple threads, like so:
    24     24    *     thread # 1: in execute() method of the SQLiteStatement object

Changes to src/org/sqlite/database/sqlite/SQLiteOpenHelper.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.content.Context;
    20         -import android.database.DatabaseErrorHandler;
    21         -import android.database.DefaultDatabaseErrorHandler;
    22         -import android.database.sqlite.SQLiteDatabase.CursorFactory;
           20  +import org.sqlite.database.DatabaseErrorHandler;
           21  +import org.sqlite.database.DefaultDatabaseErrorHandler;
           22  +import org.sqlite.database.sqlite.SQLiteDatabase.CursorFactory;
    23     23   import android.util.Log;
    24     24   
    25     25   /**
    26     26    * A helper class to manage database creation and version management.
    27     27    *
    28     28    * <p>You create a subclass implementing {@link #onCreate}, {@link #onUpgrade} and
    29     29    * optionally {@link #onOpen}, and this class takes care of opening the database
................................................................................
   217    217               } else {
   218    218                   try {
   219    219                       if (DEBUG_STRICT_READONLY && !writable) {
   220    220                           final String path = mContext.getDatabasePath(mName).getPath();
   221    221                           db = SQLiteDatabase.openDatabase(path, mFactory,
   222    222                                   SQLiteDatabase.OPEN_READONLY, mErrorHandler);
   223    223                       } else {
   224         -                        db = mContext.openOrCreateDatabase(mName, mEnableWriteAheadLogging ?
   225         -                                Context.MODE_ENABLE_WRITE_AHEAD_LOGGING : 0,
   226         -                                mFactory, mErrorHandler);
          224  +                        db = SQLiteDatabase.openOrCreateDatabase(
          225  +                                mName, mFactory, mErrorHandler
          226  +                        );
   227    227                       }
   228    228                   } catch (SQLiteException ex) {
   229    229                       if (writable) {
   230    230                           throw ex;
   231    231                       }
   232    232                       Log.e(TAG, "Couldn't open " + mName
   233    233                               + " for writing (will try read-only):", ex);

Changes to src/org/sqlite/database/sqlite/SQLiteOutOfMemoryException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteOutOfMemoryException extends SQLiteException {
    20     20       public SQLiteOutOfMemoryException() {}
    21     21   
    22     22       public SQLiteOutOfMemoryException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteProgram.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.DatabaseUtils;
    20     20   import android.os.CancellationSignal;
    21     21   
    22     22   import java.util.Arrays;
    23     23   
    24     24   /**

Changes to src/org/sqlite/database/sqlite/SQLiteQuery.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.CursorWindow;
    20     20   import android.os.CancellationSignal;
    21     21   import android.os.OperationCanceledException;
    22     22   import android.util.Log;
    23     23   
    24     24   /**

Changes to src/org/sqlite/database/sqlite/SQLiteQueryBuilder.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.Cursor;
    20     20   import android.database.DatabaseUtils;
    21     21   import android.os.CancellationSignal;
    22     22   import android.os.OperationCanceledException;
    23     23   import android.provider.BaseColumns;
    24     24   import android.text.TextUtils;

Changes to src/org/sqlite/database/sqlite/SQLiteReadOnlyDatabaseException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteReadOnlyDatabaseException extends SQLiteException {
    20     20       public SQLiteReadOnlyDatabaseException() {}
    21     21   
    22     22       public SQLiteReadOnlyDatabaseException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteSession.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.database.CursorWindow;
    20     20   import android.database.DatabaseUtils;
    21     21   import android.os.CancellationSignal;
    22     22   import android.os.OperationCanceledException;
    23     23   import android.os.ParcelFileDescriptor;
    24     24   

Changes to src/org/sqlite/database/sqlite/SQLiteStatement.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   import android.os.ParcelFileDescriptor;
    20     20   
    21     21   /**
    22     22    * Represents a statement that can be executed against a database.  The statement
    23     23    * cannot return multiple rows or columns, but single value (1 x 1) result sets
    24     24    * are supported.
................................................................................
    31     31           super(db, sql, bindArgs, null);
    32     32       }
    33     33   
    34     34       /**
    35     35        * Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example
    36     36        * CREATE / DROP table, view, trigger, index etc.
    37     37        *
    38         -     * @throws android.database.SQLException If the SQL string is invalid for
           38  +     * @throws org.sqlite.database.SQLException If the SQL string is invalid for
    39     39        *         some reason
    40     40        */
    41     41       public void execute() {
    42     42           acquireReference();
    43     43           try {
    44     44               getSession().execute(getSql(), getBindArgs(), getConnectionFlags(), null);
    45     45           } catch (SQLiteDatabaseCorruptException ex) {
................................................................................
    51     51       }
    52     52   
    53     53       /**
    54     54        * Execute this SQL statement, if the the number of rows affected by execution of this SQL
    55     55        * statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.
    56     56        *
    57     57        * @return the number of rows affected by this SQL statement execution.
    58         -     * @throws android.database.SQLException If the SQL string is invalid for
           58  +     * @throws org.sqlite.database.SQLException If the SQL string is invalid for
    59     59        *         some reason
    60     60        */
    61     61       public int executeUpdateDelete() {
    62     62           acquireReference();
    63     63           try {
    64     64               return getSession().executeForChangedRowCount(
    65     65                       getSql(), getBindArgs(), getConnectionFlags(), null);
................................................................................
    73     73   
    74     74       /**
    75     75        * Execute this SQL statement and return the ID of the row inserted due to this call.
    76     76        * The SQL statement should be an INSERT for this to be a useful call.
    77     77        *
    78     78        * @return the row ID of the last row inserted, if this insert is successful. -1 otherwise.
    79     79        *
    80         -     * @throws android.database.SQLException If the SQL string is invalid for
           80  +     * @throws org.sqlite.database.SQLException If the SQL string is invalid for
    81     81        *         some reason
    82     82        */
    83     83       public long executeInsert() {
    84     84           acquireReference();
    85     85           try {
    86     86               return getSession().executeForLastInsertedRowId(
    87     87                       getSql(), getBindArgs(), getConnectionFlags(), null);
................................................................................
    95     95   
    96     96       /**
    97     97        * Execute a statement that returns a 1 by 1 table with a numeric value.
    98     98        * For example, SELECT COUNT(*) FROM table;
    99     99        *
   100    100        * @return The result of the query.
   101    101        *
   102         -     * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows
          102  +     * @throws org.sqlite.database.sqlite.SQLiteDoneException if the query returns zero rows
   103    103        */
   104    104       public long simpleQueryForLong() {
   105    105           acquireReference();
   106    106           try {
   107    107               return getSession().executeForLong(
   108    108                       getSql(), getBindArgs(), getConnectionFlags(), null);
   109    109           } catch (SQLiteDatabaseCorruptException ex) {
................................................................................
   116    116   
   117    117       /**
   118    118        * Execute a statement that returns a 1 by 1 table with a text value.
   119    119        * For example, SELECT COUNT(*) FROM table;
   120    120        *
   121    121        * @return The result of the query.
   122    122        *
   123         -     * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows
          123  +     * @throws org.sqlite.database.sqlite.SQLiteDoneException if the query returns zero rows
   124    124        */
   125    125       public String simpleQueryForString() {
   126    126           acquireReference();
   127    127           try {
   128    128               return getSession().executeForString(
   129    129                       getSql(), getBindArgs(), getConnectionFlags(), null);
   130    130           } catch (SQLiteDatabaseCorruptException ex) {
................................................................................
   137    137   
   138    138       /**
   139    139        * Executes a statement that returns a 1 by 1 table with a blob value.
   140    140        *
   141    141        * @return A read-only file descriptor for a copy of the blob value, or {@code null}
   142    142        *         if the value is null or could not be read for some reason.
   143    143        *
   144         -     * @throws android.database.sqlite.SQLiteDoneException if the query returns zero rows
          144  +     * @throws org.sqlite.database.sqlite.SQLiteDoneException if the query returns zero rows
   145    145        */
   146    146       public ParcelFileDescriptor simpleQueryForBlobFileDescriptor() {
   147    147           acquireReference();
   148    148           try {
   149    149               return getSession().executeForBlobFileDescriptor(
   150    150                       getSql(), getBindArgs(), getConnectionFlags(), null);
   151    151           } catch (SQLiteDatabaseCorruptException ex) {

Changes to src/org/sqlite/database/sqlite/SQLiteStatementInfo.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * Describes a SQLite statement.
    21     21    *
    22     22    * @hide
    23     23    */
    24     24   public final class SQLiteStatementInfo {

Changes to src/org/sqlite/database/sqlite/SQLiteTableLockedException.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   public class SQLiteTableLockedException extends SQLiteException {
    20     20       public SQLiteTableLockedException() {}
    21     21   
    22     22       public SQLiteTableLockedException(String error) {
    23     23           super(error);
    24     24       }
    25     25   }

Changes to src/org/sqlite/database/sqlite/SQLiteTransactionListener.java.

    10     10    * Unless required by applicable law or agreed to in writing, software
    11     11    * distributed under the License is distributed on an "AS IS" BASIS,
    12     12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13     13    * See the License for the specific language governing permissions and
    14     14    * limitations under the License.
    15     15    */
    16     16   
    17         -package android.database.sqlite;
           17  +package org.sqlite.database.sqlite;
    18     18   
    19     19   /**
    20     20    * A listener for transaction events.
    21     21    */
    22     22   public interface SQLiteTransactionListener {
    23     23       /**
    24     24        * Called immediately after the transaction begins.

Changes to src/org/sqlite/database/sqlite/SqliteWrapper.java.

    11     11    * Unless required by applicable law or agreed to in writing, software
    12     12    * distributed under the License is distributed on an "AS IS" BASIS,
    13     13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14     14    * See the License for the specific language governing permissions and
    15     15    * limitations under the License.
    16     16    */
    17     17   
    18         -package android.database.sqlite;
           18  +package org.sqlite.database.sqlite;
    19     19   
    20     20   import android.content.ContentResolver;
    21     21   import android.content.ContentValues;
    22     22   import android.content.Context;
    23     23   import android.database.Cursor;
    24         -import android.database.sqlite.SQLiteException;
           24  +import org.sqlite.database.sqlite.SQLiteException;
    25     25   import android.net.Uri;
    26     26   import android.util.Log;
    27     27   import android.widget.Toast;
    28     28   
    29     29   /**
    30     30    * @hide
    31     31    */
................................................................................
    42     42       // FIXME: need to optimize this method.
    43     43       private static boolean isLowMemory(SQLiteException e) {
    44     44           return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
    45     45       }
    46     46   
    47     47       public static void checkSQLiteException(Context context, SQLiteException e) {
    48     48           if (isLowMemory(e)) {
    49         -            Toast.makeText(context, com.android.internal.R.string.low_memory,
    50         -                    Toast.LENGTH_SHORT).show();
           49  +            Toast.makeText(context, "low memory", Toast.LENGTH_SHORT).show();
    51     50           } else {
    52     51               throw e;
    53     52           }
    54     53       }
    55     54   
    56     55       public static Cursor query(Context context, ContentResolver resolver, Uri uri,
    57     56               String[] projection, String selection, String[] selectionArgs, String sortOrder) {