Thursday, January 27, 2011

Re: [android-developers] Why doesn't Cursor expose useful and public features of SQLiteCursor?

Cursor is not necessarily meant to be used with a database, it can be used to expose other types of data sources. Features specific to database cursors or SQLite do not belong in the Cursor API.

On Thu, Jan 27, 2011 at 10:33 PM, Jonathan Foley <jonefoley@gmail.com> wrote:
Looking at the source of SQLiteCursor, there are some features that
seem very useful but aren't exposed via the Cursor interface. Namely,
being able to control the windowing and intialread behaviors seems
very useful but it isn't exposed? Why not? Relevant parts are below.

/**
    *  mMaxRead is the max items that each cursor window reads
    *  default to a very high value
    */
   private int mMaxRead = Integer.MAX_VALUE;
   private int mInitialRead = Integer.MAX_VALUE;
   private int mCursorState = 0;
   private ReentrantLock mLock = null;
   private boolean mPendingData = false;

   /**
    *  support for a cursor variant that doesn't always read all
results
    *  initialRead is the initial number of items that cursor window
reads
    *  if query contains more than this number of items, a thread
will be
    *  created and handle the left over items so that caller can
show
    *  results as soon as possible
    * @param initialRead initial number of items that cursor read
    * @param maxRead leftover items read at maxRead items per time
    * @hide
    */
   public void setLoadStyle(int initialRead, int maxRead) {
       mMaxRead = maxRead;
       mInitialRead = initialRead;
       mLock = new ReentrantLock(true);
   }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
Romain Guy
Android framework engineer
romainguy@android.com

Note: please don't send private questions to me, as I don't have time to provide private support.  All such questions should be posted on public forums, where I and others can see and answer them

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment