Package org.greenrobot.greendao.query
Class CursorQuery<T>
- java.lang.Object
-
- org.greenrobot.greendao.query.CursorQuery<T>
-
- Type Parameters:
T- The entity class the query will return results for.
public class CursorQuery<T> extends java.lang.ObjectA 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 (seeQuery). This class can nevertheless be useful to work with legacy code that is based on Cursors or CursorLoaders.
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDao<T,?>daoprotected InternalQueryDaoAccess<T>daoAccessprotected intlimitPositionprotected intoffsetPositionprotected java.lang.ThreadownerThreadprotected java.lang.String[]parametersprotected java.lang.Stringsql
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckThread()CursorQueryforCurrentThread()static <T2> CursorQuery<T2>internalCreate(AbstractDao<T2,?> dao, java.lang.String sql, java.lang.Object[] initialValues)For internal use by greenDAO only.android.database.Cursorquery()Executes the query and returns a raw android.database.Cursor.voidsetLimit(int limit)Sets the limit of the maximum number of results returned by this Query.voidsetOffset(int offset)Sets the offset for results returned by this Query.CursorQuery<T>setParameter(int index, java.lang.Boolean parameter)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.CursorQuery<T>setParameter(int index, java.util.Date parameter)protected static java.lang.String[]toStringArray(java.lang.Object[] values)
-
-
-
Field Detail
-
limitPosition
protected final int limitPosition
-
offsetPosition
protected final int offsetPosition
-
dao
protected final AbstractDao<T,?> dao
-
daoAccess
protected final InternalQueryDaoAccess<T> daoAccess
-
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).
-
setParameter
public CursorQuery<T> setParameter(int index, java.util.Date parameter)
- See Also:
setParameter(int, Object)
-
setParameter
public CursorQuery<T> setParameter(int index, java.lang.Boolean parameter)
- See Also:
setParameter(int, Object)
-
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()
-
-