diff options
Diffstat (limited to 'core/java/android/database')
-rw-r--r-- | core/java/android/database/CursorWindow.java | 53 | ||||
-rw-r--r-- | core/java/android/database/sqlite/SQLiteConnection.java | 66 |
2 files changed, 60 insertions, 59 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 |