Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12016,6 +12016,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); } api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12760,6 +12760,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); } api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12103,6 +12103,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); } core/java/android/database/sqlite/SQLiteCursor.java +25 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.database.DatabaseUtils; import android.os.StrictMode; import android.util.Log; import com.android.internal.util.Preconditions; import java.util.HashMap; import java.util.Map; Loading Loading @@ -60,6 +62,9 @@ public class SQLiteCursor extends AbstractWindowedCursor { /** Used to find out where a cursor was allocated in case it never got released. */ private final Throwable mStackTrace; /** Controls fetching of rows relative to requested position **/ private boolean mFillWindowForwardOnly; /** * Execute a query and provide access to its result set through a Cursor * interface. For a query such as: {@code SELECT name, birth, phone FROM Loading Loading @@ -136,18 +141,19 @@ public class SQLiteCursor extends AbstractWindowedCursor { private void fillWindow(int requiredPos) { clearOrCreateWindow(getDatabase().getPath()); try { Preconditions.checkArgumentNonnegative(requiredPos, "requiredPos cannot be negative, but was " + requiredPos); if (mCount == NO_COUNT) { int startPos = DatabaseUtils.cursorPickFillWindowStartPosition(requiredPos, 0); mCount = mQuery.fillWindow(mWindow, startPos, requiredPos, true); mCount = mQuery.fillWindow(mWindow, requiredPos, requiredPos, true); mCursorWindowCapacity = mWindow.getNumRows(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "received count(*) from native_fill_window: " + mCount); } } else { int startPos = DatabaseUtils.cursorPickFillWindowStartPosition(requiredPos, mCursorWindowCapacity); int startPos = mFillWindowForwardOnly ? requiredPos : DatabaseUtils .cursorPickFillWindowStartPosition(requiredPos, mCursorWindowCapacity); mQuery.fillWindow(mWindow, startPos, requiredPos, false); } } catch (RuntimeException ex) { Loading Loading @@ -251,6 +257,20 @@ public class SQLiteCursor extends AbstractWindowedCursor { mDriver.setBindArguments(selectionArgs); } /** * Controls fetching of rows relative to requested position. * * <p>Calling this method defines how rows will be loaded, but it doesn't affect rows that * are already in the window. This setting is preserved if a new window is * {@link #setWindow(CursorWindow) set} * * @param fillWindowForwardOnly if true, rows will be fetched starting from requested position * up to the window's capacity. Default value is false. */ public void setFillWindowForwardOnly(boolean fillWindowForwardOnly) { mFillWindowForwardOnly = fillWindowForwardOnly; } /** * Release the native resources, if they haven't been released yet. */ Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12016,6 +12016,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); }
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12760,6 +12760,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); }
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -12103,6 +12103,7 @@ package android.database.sqlite { method public java.lang.String[] getColumnNames(); method public int getCount(); method public android.database.sqlite.SQLiteDatabase getDatabase(); method public void setFillWindowForwardOnly(boolean); method public void setSelectionArguments(java.lang.String[]); }
core/java/android/database/sqlite/SQLiteCursor.java +25 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.database.DatabaseUtils; import android.os.StrictMode; import android.util.Log; import com.android.internal.util.Preconditions; import java.util.HashMap; import java.util.Map; Loading Loading @@ -60,6 +62,9 @@ public class SQLiteCursor extends AbstractWindowedCursor { /** Used to find out where a cursor was allocated in case it never got released. */ private final Throwable mStackTrace; /** Controls fetching of rows relative to requested position **/ private boolean mFillWindowForwardOnly; /** * Execute a query and provide access to its result set through a Cursor * interface. For a query such as: {@code SELECT name, birth, phone FROM Loading Loading @@ -136,18 +141,19 @@ public class SQLiteCursor extends AbstractWindowedCursor { private void fillWindow(int requiredPos) { clearOrCreateWindow(getDatabase().getPath()); try { Preconditions.checkArgumentNonnegative(requiredPos, "requiredPos cannot be negative, but was " + requiredPos); if (mCount == NO_COUNT) { int startPos = DatabaseUtils.cursorPickFillWindowStartPosition(requiredPos, 0); mCount = mQuery.fillWindow(mWindow, startPos, requiredPos, true); mCount = mQuery.fillWindow(mWindow, requiredPos, requiredPos, true); mCursorWindowCapacity = mWindow.getNumRows(); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "received count(*) from native_fill_window: " + mCount); } } else { int startPos = DatabaseUtils.cursorPickFillWindowStartPosition(requiredPos, mCursorWindowCapacity); int startPos = mFillWindowForwardOnly ? requiredPos : DatabaseUtils .cursorPickFillWindowStartPosition(requiredPos, mCursorWindowCapacity); mQuery.fillWindow(mWindow, startPos, requiredPos, false); } } catch (RuntimeException ex) { Loading Loading @@ -251,6 +257,20 @@ public class SQLiteCursor extends AbstractWindowedCursor { mDriver.setBindArguments(selectionArgs); } /** * Controls fetching of rows relative to requested position. * * <p>Calling this method defines how rows will be loaded, but it doesn't affect rows that * are already in the window. This setting is preserved if a new window is * {@link #setWindow(CursorWindow) set} * * @param fillWindowForwardOnly if true, rows will be fetched starting from requested position * up to the window's capacity. Default value is false. */ public void setFillWindowForwardOnly(boolean fillWindowForwardOnly) { mFillWindowForwardOnly = fillWindowForwardOnly; } /** * Release the native resources, if they haven't been released yet. */ Loading