Class CursorQuery<T>

  • Type Parameters:
    T - The entity class the query will return results for.

    public class CursorQuery<T>
    extends java.lang.Object
    A repeatable query returning a raw android.database.Cursor. Note, that using cursors is usually a hassle and greenDAO provides a higher level abstraction using entities (see Query). This class can nevertheless be useful to work with legacy code that is based on Cursors or CursorLoaders.
    • Field Detail

      • limitPosition

        protected final int limitPosition
      • offsetPosition

        protected final int offsetPosition
      • sql

        protected final java.lang.String sql
      • parameters

        protected final java.lang.String[] parameters
      • ownerThread

        protected final java.lang.Thread ownerThread
    • Method Detail

      • internalCreate

        public static <T2> CursorQuery<T2> internalCreate​(AbstractDao<T2,​?> dao,
                                                          java.lang.String sql,
                                                          java.lang.Object[] initialValues)
        For internal use by greenDAO only.
      • forCurrentThread

        public CursorQuery forCurrentThread()
      • query

        public android.database.Cursor query()
        Executes the query and returns a raw android.database.Cursor. Don't forget to close it.
      • setParameter

        public CursorQuery<T> setParameter​(int index,
                                           java.lang.Object parameter)
        Sets the parameter (0 based) using the position in which it was added during building the query. Note: all standard WHERE parameters come first. After that come the WHERE parameters of joins (if any).
      • setLimit

        public void setLimit​(int limit)
        Sets the limit of the maximum number of results returned by this Query. QueryBuilder.limit(int) must have been called on the QueryBuilder that created this Query object.
      • setOffset

        public void setOffset​(int offset)
        Sets the offset for results returned by this Query. QueryBuilder.offset(int) must have been called on the QueryBuilder that created this Query object.
      • toStringArray

        protected static java.lang.String[] toStringArray​(java.lang.Object[] values)
      • checkThread

        protected void checkThread()