diff options
-rw-r--r-- | core/java/android/database/CursorWindow.java | 53 | ||||
-rw-r--r-- | core/java/android/database/sqlite/SQLiteConnection.java | 66 | ||||
-rw-r--r-- | core/jni/android_database_CursorWindow.cpp | 88 | ||||
-rw-r--r-- | core/jni/android_database_SQLiteConnection.cpp | 132 |
4 files changed, 170 insertions, 169 deletions
diff --git a/core/java/android/database/CursorWindow.java b/core/java/android/database/CursorWindow.java index f1f3017..197e3ff 100644 --- a/core/java/android/database/CursorWindow.java +++ b/core/java/android/database/CursorWindow.java @@ -27,6 +27,7 @@ import android.os.Parcelable; import android.os.Process; import android.util.Log; import android.util.SparseIntArray; +import android.util.LongSparseArray; /** * A buffer containing multiple cursor rows. @@ -52,40 +53,40 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { * The native CursorWindow object pointer. (FOR INTERNAL USE ONLY) * @hide */ - public int mWindowPtr; + public long mWindowPtr; private int mStartPos; private final String mName; private final CloseGuard mCloseGuard = CloseGuard.get(); - private static native int nativeCreate(String name, int cursorWindowSize); - private static native int nativeCreateFromParcel(Parcel parcel); - private static native void nativeDispose(int windowPtr); - private static native void nativeWriteToParcel(int windowPtr, Parcel parcel); + private static native long nativeCreate(String name, int cursorWindowSize); + private static native long nativeCreateFromParcel(Parcel parcel); + private static native void nativeDispose(long windowPtr); + private static native void nativeWriteToParcel(long windowPtr, Parcel parcel); - private static native void nativeClear(int windowPtr); + private static native void nativeClear(long windowPtr); - private static native int nativeGetNumRows(int windowPtr); - private static native boolean nativeSetNumColumns(int windowPtr, int columnNum); - private static native boolean nativeAllocRow(int windowPtr); - private static native void nativeFreeLastRow(int windowPtr); + private static native int nativeGetNumRows(long windowPtr); + private static native boolean nativeSetNumColumns(long windowPtr, int columnNum); + private static native boolean nativeAllocRow(long windowPtr); + private static native void nativeFreeLastRow(long windowPtr); - private static native int nativeGetType(int windowPtr, int row, int column); - private static native byte[] nativeGetBlob(int windowPtr, int row, int column); - private static native String nativeGetString(int windowPtr, int row, int column); - private static native long nativeGetLong(int windowPtr, int row, int column); - private static native double nativeGetDouble(int windowPtr, int row, int column); - private static native void nativeCopyStringToBuffer(int windowPtr, int row, int column, + private static native int nativeGetType(long windowPtr, int row, int column); + private static native byte[] nativeGetBlob(long windowPtr, int row, int column); + private static native String nativeGetString(long windowPtr, int row, int column); + private static native long nativeGetLong(long windowPtr, int row, int column); + private static native double nativeGetDouble(long windowPtr, int row, int column); + private static native void nativeCopyStringToBuffer(long windowPtr, int row, int column, CharArrayBuffer buffer); - private static native boolean nativePutBlob(int windowPtr, byte[] value, int row, int column); - private static native boolean nativePutString(int windowPtr, String value, int row, int column); - private static native boolean nativePutLong(int windowPtr, long value, int row, int column); - private static native boolean nativePutDouble(int windowPtr, double value, int row, int column); - private static native boolean nativePutNull(int windowPtr, int row, int column); + private static native boolean nativePutBlob(long windowPtr, byte[] value, int row, int column); + private static native boolean nativePutString(long windowPtr, String value, int row, int column); + private static native boolean nativePutLong(long windowPtr, long value, int row, int column); + private static native boolean nativePutDouble(long windowPtr, double value, int row, int column); + private static native boolean nativePutNull(long windowPtr, int row, int column); - private static native String nativeGetName(int windowPtr); + private static native String nativeGetName(long windowPtr); /** * Creates a new empty cursor window and gives it a name. @@ -713,9 +714,9 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { dispose(); } - private static final SparseIntArray sWindowToPidMap = new SparseIntArray(); + private static final LongSparseArray<Integer> sWindowToPidMap = new LongSparseArray<Integer>(); - private void recordNewWindow(int pid, int window) { + private void recordNewWindow(int pid, long window) { synchronized (sWindowToPidMap) { sWindowToPidMap.put(window, pid); if (Log.isLoggable(STATS_TAG, Log.VERBOSE)) { @@ -724,7 +725,7 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { } } - private void recordClosingOfWindow(int window) { + private void recordClosingOfWindow(long window) { synchronized (sWindowToPidMap) { if (sWindowToPidMap.size() == 0) { // this means we are not in the ContentProvider. @@ -771,6 +772,6 @@ public class CursorWindow extends SQLiteClosable implements Parcelable { @Override public String toString() { - return getName() + " {" + Integer.toHexString(mWindowPtr) + "}"; + return getName() + " {" + Long.toHexString(mWindowPtr) + "}"; } } diff --git a/core/java/android/database/sqlite/SQLiteConnection.java b/core/java/android/database/sqlite/SQLiteConnection.java index 725a1ff..24a7d33 100644 --- a/core/java/android/database/sqlite/SQLiteConnection.java +++ b/core/java/android/database/sqlite/SQLiteConnection.java @@ -107,7 +107,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen private final OperationLog mRecentOperations = new OperationLog(); // The native SQLiteConnection pointer. (FOR INTERNAL USE ONLY) - private int mConnectionPtr; + private long mConnectionPtr; private boolean mOnlyAllowReadOnlyOperations; @@ -117,45 +117,45 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen // we can ensure that we detach the signal at the right time. private int mCancellationSignalAttachCount; - private static native int nativeOpen(String path, int openFlags, String label, + private static native long nativeOpen(String path, int openFlags, String label, boolean enableTrace, boolean enableProfile); - private static native void nativeClose(int connectionPtr); - private static native void nativeRegisterCustomFunction(int connectionPtr, + private static native void nativeClose(long connectionPtr); + private static native void nativeRegisterCustomFunction(long connectionPtr, SQLiteCustomFunction function); - private static native void nativeRegisterLocalizedCollators(int connectionPtr, String locale); - private static native int nativePrepareStatement(int connectionPtr, String sql); - private static native void nativeFinalizeStatement(int connectionPtr, int statementPtr); - private static native int nativeGetParameterCount(int connectionPtr, int statementPtr); - private static native boolean nativeIsReadOnly(int connectionPtr, int statementPtr); - private static native int nativeGetColumnCount(int connectionPtr, int statementPtr); - private static native String nativeGetColumnName(int connectionPtr, int statementPtr, + private static native void nativeRegisterLocalizedCollators(long connectionPtr, String locale); + private static native long nativePrepareStatement(long connectionPtr, String sql); + private static native void nativeFinalizeStatement(long connectionPtr, long statementPtr); + private static native int nativeGetParameterCount(long connectionPtr, long statementPtr); + private static native boolean nativeIsReadOnly(long connectionPtr, long statementPtr); + private static native int nativeGetColumnCount(long connectionPtr, long statementPtr); + private static native String nativeGetColumnName(long connectionPtr, long statementPtr, int index); - private static native void nativeBindNull(int connectionPtr, int statementPtr, + private static native void nativeBindNull(long connectionPtr, long statementPtr, int index); - private static native void nativeBindLong(int connectionPtr, int statementPtr, + private static native void nativeBindLong(long connectionPtr, long statementPtr, int index, long value); - private static native void nativeBindDouble(int connectionPtr, int statementPtr, + private static native void nativeBindDouble(long connectionPtr, long statementPtr, int index, double value); - private static native void nativeBindString(int connectionPtr, int statementPtr, + private static native void nativeBindString(long connectionPtr, long statementPtr, int index, String value); - private static native void nativeBindBlob(int connectionPtr, int statementPtr, + private static native void nativeBindBlob(long connectionPtr, long statementPtr, int index, byte[] value); private static native void nativeResetStatementAndClearBindings( - int connectionPtr, int statementPtr); - private static native void nativeExecute(int connectionPtr, int statementPtr); - private static native long nativeExecuteForLong(int connectionPtr, int statementPtr); - private static native String nativeExecuteForString(int connectionPtr, int statementPtr); + long connectionPtr, long statementPtr); + private static native void nativeExecute(long connectionPtr, long statementPtr); + private static native long nativeExecuteForLong(long connectionPtr, long statementPtr); + private static native String nativeExecuteForString(long connectionPtr, long statementPtr); private static native int nativeExecuteForBlobFileDescriptor( - int connectionPtr, int statementPtr); - private static native int nativeExecuteForChangedRowCount(int connectionPtr, int statementPtr); + long connectionPtr, long statementPtr); + private static native int nativeExecuteForChangedRowCount(long connectionPtr, long statementPtr); private static native long nativeExecuteForLastInsertedRowId( - int connectionPtr, int statementPtr); + long connectionPtr, long statementPtr); private static native long nativeExecuteForCursorWindow( - int connectionPtr, int statementPtr, int windowPtr, + long connectionPtr, long statementPtr, long windowPtr, int startPos, int requiredPos, boolean countAllRows); - private static native int nativeGetDbLookaside(int connectionPtr); - private static native void nativeCancel(int connectionPtr); - private static native void nativeResetCancel(int connectionPtr, boolean cancelable); + private static native int nativeGetDbLookaside(long connectionPtr); + private static native void nativeCancel(long connectionPtr); + private static native void nativeResetCancel(long connectionPtr, boolean cancelable); private SQLiteConnection(SQLiteConnectionPool pool, SQLiteDatabaseConfiguration configuration, @@ -886,7 +886,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen skipCache = true; } - final int statementPtr = nativePrepareStatement(mConnectionPtr, sql); + final long statementPtr = nativePrepareStatement(mConnectionPtr, sql); try { final int numParameters = nativeGetParameterCount(mConnectionPtr, statementPtr); final int type = DatabaseUtils.getSqlStatementType(sql); @@ -987,7 +987,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen return; } - final int statementPtr = statement.mStatementPtr; + final long statementPtr = statement.mStatementPtr; for (int i = 0; i < count; i++) { final Object arg = bindArgs[i]; switch (DatabaseUtils.getTypeOfObject(arg)) { @@ -1072,7 +1072,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen void dumpUnsafe(Printer printer, boolean verbose) { printer.println("Connection #" + mConnectionId + ":"); if (verbose) { - printer.println(" connectionPtr: 0x" + Integer.toHexString(mConnectionPtr)); + printer.println(" connectionPtr: 0x" + Long.toHexString(mConnectionPtr)); } printer.println(" isPrimaryConnection: " + mIsPrimaryConnection); printer.println(" onlyAllowReadOnlyOperations: " + mOnlyAllowReadOnlyOperations); @@ -1178,7 +1178,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen return "SQLiteConnection: " + mConfiguration.path + " (" + mConnectionId + ")"; } - private PreparedStatement obtainPreparedStatement(String sql, int statementPtr, + private PreparedStatement obtainPreparedStatement(String sql, long statementPtr, int numParameters, int type, boolean readOnly) { PreparedStatement statement = mPreparedStatementPool; if (statement != null) { @@ -1225,7 +1225,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen // The native sqlite3_stmt object pointer. // Lifetime is managed explicitly by the connection. - public int mStatementPtr; + public long mStatementPtr; // The number of parameters that the prepared statement has. public int mNumParameters; @@ -1271,7 +1271,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen if (statement.mInCache) { // might be false due to a race with entryRemoved String sql = entry.getKey(); printer.println(" " + i + ": statementPtr=0x" - + Integer.toHexString(statement.mStatementPtr) + + Long.toHexString(statement.mStatementPtr) + ", numParameters=" + statement.mNumParameters + ", type=" + statement.mType + ", readOnly=" + statement.mReadOnly diff --git a/core/jni/android_database_CursorWindow.cpp b/core/jni/android_database_CursorWindow.cpp index ea02f53..67f3879 100644 --- a/core/jni/android_database_CursorWindow.cpp +++ b/core/jni/android_database_CursorWindow.cpp @@ -58,7 +58,7 @@ static void throwUnknownTypeException(JNIEnv * env, jint type) { jniThrowException(env, "java/lang/IllegalStateException", msg.string()); } -static jint nativeCreate(JNIEnv* env, jclass clazz, jstring nameObj, jint cursorWindowSize) { +static jlong nativeCreate(JNIEnv* env, jclass clazz, jstring nameObj, jint cursorWindowSize) { String8 name; const char* nameStr = env->GetStringUTFChars(nameObj, NULL); name.setTo(nameStr); @@ -73,10 +73,10 @@ static jint nativeCreate(JNIEnv* env, jclass clazz, jstring nameObj, jint cursor } LOG_WINDOW("nativeInitializeEmpty: window = %p", window); - return reinterpret_cast<jint>(window); + return reinterpret_cast<jlong>(window); } -static jint nativeCreateFromParcel(JNIEnv* env, jclass clazz, jobject parcelObj) { +static jlong nativeCreateFromParcel(JNIEnv* env, jclass clazz, jobject parcelObj) { Parcel* parcel = parcelForJavaObject(env, parcelObj); CursorWindow* window; @@ -88,10 +88,10 @@ static jint nativeCreateFromParcel(JNIEnv* env, jclass clazz, jobject parcelObj) LOG_WINDOW("nativeInitializeFromBinder: numRows = %d, numColumns = %d, window = %p", window->getNumRows(), window->getNumColumns(), window); - return reinterpret_cast<jint>(window); + return reinterpret_cast<jlong>(window); } -static void nativeDispose(JNIEnv* env, jclass clazz, jint windowPtr) { +static void nativeDispose(JNIEnv* env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); if (window) { LOG_WINDOW("Closing window %p", window); @@ -99,12 +99,12 @@ static void nativeDispose(JNIEnv* env, jclass clazz, jint windowPtr) { } } -static jstring nativeGetName(JNIEnv* env, jclass clazz, jint windowPtr) { +static jstring nativeGetName(JNIEnv* env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); return env->NewStringUTF(window->name().string()); } -static void nativeWriteToParcel(JNIEnv * env, jclass clazz, jint windowPtr, +static void nativeWriteToParcel(JNIEnv * env, jclass clazz, jlong windowPtr, jobject parcelObj) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); Parcel* parcel = parcelForJavaObject(env, parcelObj); @@ -117,7 +117,7 @@ static void nativeWriteToParcel(JNIEnv * env, jclass clazz, jint windowPtr, } } -static void nativeClear(JNIEnv * env, jclass clazz, jint windowPtr) { +static void nativeClear(JNIEnv * env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Clearing window %p", window); status_t status = window->clear(); @@ -126,30 +126,30 @@ static void nativeClear(JNIEnv * env, jclass clazz, jint windowPtr) { } } -static jint nativeGetNumRows(JNIEnv* env, jclass clazz, jint windowPtr) { +static jint nativeGetNumRows(JNIEnv* env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); return window->getNumRows(); } -static jboolean nativeSetNumColumns(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativeSetNumColumns(JNIEnv* env, jclass clazz, jlong windowPtr, jint columnNum) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->setNumColumns(columnNum); return status == OK; } -static jboolean nativeAllocRow(JNIEnv* env, jclass clazz, jint windowPtr) { +static jboolean nativeAllocRow(JNIEnv* env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->allocRow(); return status == OK; } -static void nativeFreeLastRow(JNIEnv* env, jclass clazz, jint windowPtr) { +static void nativeFreeLastRow(JNIEnv* env, jclass clazz, jlong windowPtr) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); window->freeLastRow(); } -static jint nativeGetType(JNIEnv* env, jclass clazz, jint windowPtr, +static jint nativeGetType(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("returning column type affinity for %d,%d from %p", row, column, window); @@ -164,7 +164,7 @@ static jint nativeGetType(JNIEnv* env, jclass clazz, jint windowPtr, return window->getFieldSlotType(fieldSlot); } -static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jint windowPtr, +static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Getting blob for %d,%d from %p", row, column, window); @@ -199,7 +199,7 @@ static jbyteArray nativeGetBlob(JNIEnv* env, jclass clazz, jint windowPtr, return NULL; } -static jstring nativeGetString(JNIEnv* env, jclass clazz, jint windowPtr, +static jstring nativeGetString(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Getting string for %d,%d from %p", row, column, window); @@ -291,7 +291,7 @@ static void clearCharArrayBuffer(JNIEnv* env, jobject bufferObj) { } } -static void nativeCopyStringToBuffer(JNIEnv* env, jclass clazz, jint windowPtr, +static void nativeCopyStringToBuffer(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column, jobject bufferObj) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Copying string for %d,%d from %p", row, column, window); @@ -330,7 +330,7 @@ static void nativeCopyStringToBuffer(JNIEnv* env, jclass clazz, jint windowPtr, } } -static jlong nativeGetLong(JNIEnv* env, jclass clazz, jint windowPtr, +static jlong nativeGetLong(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Getting long for %d,%d from %p", row, column, window); @@ -361,7 +361,7 @@ static jlong nativeGetLong(JNIEnv* env, jclass clazz, jint windowPtr, } } -static jdouble nativeGetDouble(JNIEnv* env, jclass clazz, jint windowPtr, +static jdouble nativeGetDouble(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); LOG_WINDOW("Getting double for %d,%d from %p", row, column, window); @@ -392,7 +392,7 @@ static jdouble nativeGetDouble(JNIEnv* env, jclass clazz, jint windowPtr, } } -static jboolean nativePutBlob(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativePutBlob(JNIEnv* env, jclass clazz, jlong windowPtr, jbyteArray valueObj, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); jsize len = env->GetArrayLength(valueObj); @@ -410,7 +410,7 @@ static jboolean nativePutBlob(JNIEnv* env, jclass clazz, jint windowPtr, return true; } -static jboolean nativePutString(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativePutString(JNIEnv* env, jclass clazz, jlong windowPtr, jstring valueObj, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); @@ -432,7 +432,7 @@ static jboolean nativePutString(JNIEnv* env, jclass clazz, jint windowPtr, return true; } -static jboolean nativePutLong(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativePutLong(JNIEnv* env, jclass clazz, jlong windowPtr, jlong value, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->putLong(row, column, value); @@ -446,7 +446,7 @@ static jboolean nativePutLong(JNIEnv* env, jclass clazz, jint windowPtr, return true; } -static jboolean nativePutDouble(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativePutDouble(JNIEnv* env, jclass clazz, jlong windowPtr, jdouble value, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->putDouble(row, column, value); @@ -460,7 +460,7 @@ static jboolean nativePutDouble(JNIEnv* env, jclass clazz, jint windowPtr, return true; } -static jboolean nativePutNull(JNIEnv* env, jclass clazz, jint windowPtr, +static jboolean nativePutNull(JNIEnv* env, jclass clazz, jlong windowPtr, jint row, jint column) { CursorWindow* window = reinterpret_cast<CursorWindow*>(windowPtr); status_t status = window->putNull(row, column); @@ -477,47 +477,47 @@ static jboolean nativePutNull(JNIEnv* env, jclass clazz, jint windowPtr, static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ - { "nativeCreate", "(Ljava/lang/String;I)I", + { "nativeCreate", "(Ljava/lang/String;I)J", (void*)nativeCreate }, - { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", + { "nativeCreateFromParcel", "(Landroid/os/Parcel;)J", (void*)nativeCreateFromParcel }, - { "nativeDispose", "(I)V", + { "nativeDispose", "(J)V", (void*)nativeDispose }, - { "nativeWriteToParcel", "(ILandroid/os/Parcel;)V", + { "nativeWriteToParcel", "(JLandroid/os/Parcel;)V", (void*)nativeWriteToParcel }, - { "nativeGetName", "(I)Ljava/lang/String;", + { "nativeGetName", "(J)Ljava/lang/String;", (void*)nativeGetName }, - { "nativeClear", "(I)V", + { "nativeClear", "(J)V", (void*)nativeClear }, - { "nativeGetNumRows", "(I)I", + { "nativeGetNumRows", "(J)I", (void*)nativeGetNumRows }, - { "nativeSetNumColumns", "(II)Z", + { "nativeSetNumColumns", "(JI)Z", (void*)nativeSetNumColumns }, - { "nativeAllocRow", "(I)Z", + { "nativeAllocRow", "(J)Z", (void*)nativeAllocRow }, - { "nativeFreeLastRow", "(I)V", + { "nativeFreeLastRow", "(J)V", (void*)nativeFreeLastRow }, - { "nativeGetType", "(III)I", + { "nativeGetType", "(JII)I", (void*)nativeGetType }, - { "nativeGetBlob", "(III)[B", + { "nativeGetBlob", "(JII)[B", (void*)nativeGetBlob }, - { "nativeGetString", "(III)Ljava/lang/String;", + { "nativeGetString", "(JII)Ljava/lang/String;", (void*)nativeGetString }, - { "nativeGetLong", "(III)J", + { "nativeGetLong", "(JII)J", (void*)nativeGetLong }, - { "nativeGetDouble", "(III)D", + { "nativeGetDouble", "(JII)D", (void*)nativeGetDouble }, - { "nativeCopyStringToBuffer", "(IIILandroid/database/CharArrayBuffer;)V", + { "nativeCopyStringToBuffer", "(JIILandroid/database/CharArrayBuffer;)V", (void*)nativeCopyStringToBuffer }, - { "nativePutBlob", "(I[BII)Z", + { "nativePutBlob", "(J[BII)Z", (void*)nativePutBlob }, - { "nativePutString", "(ILjava/lang/String;II)Z", + { "nativePutString", "(JLjava/lang/String;II)Z", (void*)nativePutString }, - { "nativePutLong", "(IJII)Z", + { "nativePutLong", "(JJII)Z", (void*)nativePutLong }, - { "nativePutDouble", "(IDII)Z", + { "nativePutDouble", "(JDII)Z", (void*)nativePutDouble }, - { "nativePutNull", "(III)Z", + { "nativePutNull", "(JII)Z", (void*)nativePutNull }, }; diff --git a/core/jni/android_database_SQLiteConnection.cpp b/core/jni/android_database_SQLiteConnection.cpp index 6e496fd..ae56432 100644 --- a/core/jni/android_database_SQLiteConnection.cpp +++ b/core/jni/android_database_SQLiteConnection.cpp @@ -109,7 +109,7 @@ static int sqliteProgressHandlerCallback(void* data) { } -static jint nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFlags, +static jlong nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFlags, jstring labelStr, jboolean enableTrace, jboolean enableProfile) { int sqliteFlags; if (openFlags & SQLiteConnection::CREATE_IF_NECESSARY) { @@ -170,10 +170,10 @@ static jint nativeOpen(JNIEnv* env, jclass clazz, jstring pathStr, jint openFlag } ALOGV("Opened connection %p with label '%s'", db, label.string()); - return reinterpret_cast<jint>(connection); + return reinterpret_cast<jlong>(connection); } -static void nativeClose(JNIEnv* env, jclass clazz, jint connectionPtr) { +static void nativeClose(JNIEnv* env, jclass clazz, jlong connectionPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); if (connection) { @@ -243,7 +243,7 @@ static void sqliteCustomFunctionDestructor(void* data) { env->DeleteGlobalRef(functionObjGlobal); } -static void nativeRegisterCustomFunction(JNIEnv* env, jclass clazz, jint connectionPtr, +static void nativeRegisterCustomFunction(JNIEnv* env, jclass clazz, jlong connectionPtr, jobject functionObj) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); @@ -267,7 +267,7 @@ static void nativeRegisterCustomFunction(JNIEnv* env, jclass clazz, jint connect } } -static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jint connectionPtr, +static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jlong connectionPtr, jstring localeStr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); @@ -280,7 +280,7 @@ static void nativeRegisterLocalizedCollators(JNIEnv* env, jclass clazz, jint con } } -static jint nativePrepareStatement(JNIEnv* env, jclass clazz, jint connectionPtr, +static jlong nativePrepareStatement(JNIEnv* env, jclass clazz, jlong connectionPtr, jstring sqlString) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); @@ -308,11 +308,11 @@ static jint nativePrepareStatement(JNIEnv* env, jclass clazz, jint connectionPtr } ALOGV("Prepared statement %p on connection %p", statement, connection->db); - return reinterpret_cast<jint>(statement); + return reinterpret_cast<jlong>(statement); } -static void nativeFinalizeStatement(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static void nativeFinalizeStatement(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -323,32 +323,32 @@ static void nativeFinalizeStatement(JNIEnv* env, jclass clazz, jint connectionPt sqlite3_finalize(statement); } -static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static jint nativeGetParameterCount(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_bind_parameter_count(statement); } -static jboolean nativeIsReadOnly(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static jboolean nativeIsReadOnly(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_stmt_readonly(statement) != 0; } -static jint nativeGetColumnCount(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static jint nativeGetColumnCount(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); return sqlite3_column_count(statement); } -static jstring nativeGetColumnName(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index) { +static jstring nativeGetColumnName(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -363,8 +363,8 @@ static jstring nativeGetColumnName(JNIEnv* env, jclass clazz, jint connectionPtr return NULL; } -static void nativeBindNull(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index) { +static void nativeBindNull(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -374,8 +374,8 @@ static void nativeBindNull(JNIEnv* env, jclass clazz, jint connectionPtr, } } -static void nativeBindLong(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index, jlong value) { +static void nativeBindLong(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index, jlong value) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -385,8 +385,8 @@ static void nativeBindLong(JNIEnv* env, jclass clazz, jint connectionPtr, } } -static void nativeBindDouble(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index, jdouble value) { +static void nativeBindDouble(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index, jdouble value) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -396,8 +396,8 @@ static void nativeBindDouble(JNIEnv* env, jclass clazz, jint connectionPtr, } } -static void nativeBindString(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index, jstring valueString) { +static void nativeBindString(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index, jstring valueString) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -411,8 +411,8 @@ static void nativeBindString(JNIEnv* env, jclass clazz, jint connectionPtr, } } -static void nativeBindBlob(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr, jint index, jbyteArray valueArray) { +static void nativeBindBlob(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr, jint index, jbyteArray valueArray) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -425,8 +425,8 @@ static void nativeBindBlob(JNIEnv* env, jclass clazz, jint connectionPtr, } } -static void nativeResetStatementAndClearBindings(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static void nativeResetStatementAndClearBindings(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -450,8 +450,8 @@ static int executeNonQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3_st return err; } -static void nativeExecute(JNIEnv* env, jclass clazz, jint connectionPtr, - jint statementPtr) { +static void nativeExecute(JNIEnv* env, jclass clazz, jlong connectionPtr, + jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -459,7 +459,7 @@ static void nativeExecute(JNIEnv* env, jclass clazz, jint connectionPtr, } static jint nativeExecuteForChangedRowCount(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr) { + jlong connectionPtr, jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -468,7 +468,7 @@ static jint nativeExecuteForChangedRowCount(JNIEnv* env, jclass clazz, } static jlong nativeExecuteForLastInsertedRowId(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr) { + jlong connectionPtr, jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -486,7 +486,7 @@ static int executeOneRowQuery(JNIEnv* env, SQLiteConnection* connection, sqlite3 } static jlong nativeExecuteForLong(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr) { + jlong connectionPtr, jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -498,7 +498,7 @@ static jlong nativeExecuteForLong(JNIEnv* env, jclass clazz, } static jstring nativeExecuteForString(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr) { + jlong connectionPtr, jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -548,7 +548,7 @@ static int createAshmemRegionWithData(JNIEnv* env, const void* data, size_t leng } static jint nativeExecuteForBlobFileDescriptor(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr) { + jlong connectionPtr, jlong statementPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -665,7 +665,7 @@ static CopyRowResult copyRow(JNIEnv* env, CursorWindow* window, } static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz, - jint connectionPtr, jint statementPtr, jint windowPtr, + jlong connectionPtr, jlong statementPtr, jlong windowPtr, jint startPos, jint requiredPos, jboolean countAllRows) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); sqlite3_stmt* statement = reinterpret_cast<sqlite3_stmt*>(statementPtr); @@ -760,7 +760,7 @@ static jlong nativeExecuteForCursorWindow(JNIEnv* env, jclass clazz, return result; } -static jint nativeGetDbLookaside(JNIEnv* env, jobject clazz, jint connectionPtr) { +static jint nativeGetDbLookaside(JNIEnv* env, jobject clazz, jlong connectionPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); int cur = -1; @@ -769,12 +769,12 @@ static jint nativeGetDbLookaside(JNIEnv* env, jobject clazz, jint connectionPtr) return cur; } -static void nativeCancel(JNIEnv* env, jobject clazz, jint connectionPtr) { +static void nativeCancel(JNIEnv* env, jobject clazz, jlong connectionPtr) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); connection->canceled = true; } -static void nativeResetCancel(JNIEnv* env, jobject clazz, jint connectionPtr, +static void nativeResetCancel(JNIEnv* env, jobject clazz, jlong connectionPtr, jboolean cancelable) { SQLiteConnection* connection = reinterpret_cast<SQLiteConnection*>(connectionPtr); connection->canceled = false; @@ -791,57 +791,57 @@ static void nativeResetCancel(JNIEnv* env, jobject clazz, jint connectionPtr, static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ - { "nativeOpen", "(Ljava/lang/String;ILjava/lang/String;ZZ)I", + { "nativeOpen", "(Ljava/lang/String;ILjava/lang/String;ZZ)J", (void*)nativeOpen }, - { "nativeClose", "(I)V", + { "nativeClose", "(J)V", (void*)nativeClose }, - { "nativeRegisterCustomFunction", "(ILandroid/database/sqlite/SQLiteCustomFunction;)V", + { "nativeRegisterCustomFunction", "(JLandroid/database/sqlite/SQLiteCustomFunction;)V", (void*)nativeRegisterCustomFunction }, - { "nativeRegisterLocalizedCollators", "(ILjava/lang/String;)V", + { "nativeRegisterLocalizedCollators", "(JLjava/lang/String;)V", (void*)nativeRegisterLocalizedCollators }, - { "nativePrepareStatement", "(ILjava/lang/String;)I", + { "nativePrepareStatement", "(JLjava/lang/String;)J", (void*)nativePrepareStatement }, - { "nativeFinalizeStatement", "(II)V", + { "nativeFinalizeStatement", "(JJ)V", (void*)nativeFinalizeStatement }, - { "nativeGetParameterCount", "(II)I", + { "nativeGetParameterCount", "(JJ)I", (void*)nativeGetParameterCount }, - { "nativeIsReadOnly", "(II)Z", + { "nativeIsReadOnly", "(JJ)Z", (void*)nativeIsReadOnly }, - { "nativeGetColumnCount", "(II)I", + { "nativeGetColumnCount", "(JJ)I", (void*)nativeGetColumnCount }, - { "nativeGetColumnName", "(III)Ljava/lang/String;", + { "nativeGetColumnName", "(JJI)Ljava/lang/String;", (void*)nativeGetColumnName }, - { "nativeBindNull", "(III)V", + { "nativeBindNull", "(JJI)V", (void*)nativeBindNull }, - { "nativeBindLong", "(IIIJ)V", + { "nativeBindLong", "(JJIJ)V", (void*)nativeBindLong }, - { "nativeBindDouble", "(IIID)V", + { "nativeBindDouble", "(JJID)V", (void*)nativeBindDouble }, - { "nativeBindString", "(IIILjava/lang/String;)V", + { "nativeBindString", "(JJILjava/lang/String;)V", (void*)nativeBindString }, - { "nativeBindBlob", "(III[B)V", + { "nativeBindBlob", "(JJI[B)V", (void*)nativeBindBlob }, - { "nativeResetStatementAndClearBindings", "(II)V", + { "nativeResetStatementAndClearBindings", "(JJ)V", (void*)nativeResetStatementAndClearBindings }, - { "nativeExecute", "(II)V", + { "nativeExecute", "(JJ)V", (void*)nativeExecute }, - { "nativeExecuteForLong", "(II)J", + { "nativeExecuteForLong", "(JJ)J", (void*)nativeExecuteForLong }, - { "nativeExecuteForString", "(II)Ljava/lang/String;", + { "nativeExecuteForString", "(JJ)Ljava/lang/String;", (void*)nativeExecuteForString }, - { "nativeExecuteForBlobFileDescriptor", "(II)I", + { "nativeExecuteForBlobFileDescriptor", "(JJ)I", (void*)nativeExecuteForBlobFileDescriptor }, - { "nativeExecuteForChangedRowCount", "(II)I", + { "nativeExecuteForChangedRowCount", "(JJ)I", (void*)nativeExecuteForChangedRowCount }, - { "nativeExecuteForLastInsertedRowId", "(II)J", + { "nativeExecuteForLastInsertedRowId", "(JJ)J", (void*)nativeExecuteForLastInsertedRowId }, - { "nativeExecuteForCursorWindow", "(IIIIIZ)J", + { "nativeExecuteForCursorWindow", "(JJJIIZ)J", (void*)nativeExecuteForCursorWindow }, - { "nativeGetDbLookaside", "(I)I", + { "nativeGetDbLookaside", "(J)I", (void*)nativeGetDbLookaside }, - { "nativeCancel", "(I)V", + { "nativeCancel", "(J)V", (void*)nativeCancel }, - { "nativeResetCancel", "(IZ)V", + { "nativeResetCancel", "(JZ)V", (void*)nativeResetCancel }, }; |