public class SQLiteCursor extends AbstractWindowedCursor
SQLiteDatabase.
SQLiteCursor is not internally synchronized so code using a SQLiteCursor from multiple
threads should perform its own synchronization when using the SQLiteCursor.mWindowmClosed, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRowsFIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING| Constructor and Description |
|---|
SQLiteCursor(SQLiteCursorDriver driver,
String editTable,
SQLiteQuery query)
Execute a query and provide access to its result set through a Cursor
interface.
|
SQLiteCursor(SQLiteDatabase db,
SQLiteCursorDriver driver,
String editTable,
SQLiteQuery query)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the Cursor, releasing all of its resources and making it completely invalid.
|
void |
deactivate()
Deactivates the Cursor, making all calls on it fail until
Cursor.requery() is called. |
protected void |
finalize()
Release the native resources, if they haven't been released yet.
|
int |
getColumnIndex(String columnName)
Returns the zero-based index for the given column name, or -1 if the column doesn't exist.
|
String[] |
getColumnNames()
Returns a string array holding the names of all of the columns in the
result set in the order in which they were listed in the result.
|
int |
getCount()
Returns the numbers of rows in the cursor.
|
SQLiteDatabase |
getDatabase()
Get the database that this cursor is associated with.
|
boolean |
onMove(int oldPosition,
int newPosition)
This function is called every time the cursor is successfully scrolled
to a new position, giving the subclass a chance to update any state it
may have.
|
boolean |
requery()
Performs the query that created the cursor again, refreshing its
contents.
|
void |
setSelectionArguments(String[] selectionArgs)
Changes the selection arguments.
|
void |
setWindow(CursorWindow window)
Sets a new cursor window for the cursor to use.
|
checkPosition, clearOrCreateWindow, closeWindow, copyStringToBuffer, getBlob, getDouble, getFloat, getInt, getLong, getShort, getString, getType, getWindow, hasWindow, isBlob, isFloat, isLong, isNull, isString, onDeactivateOrClosefillWindow, getColumnCount, getColumnIndexOrThrow, getColumnName, getExtras, getPosition, getUpdatedField, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, registerDataSetObserver, respond, setExtras, unregisterDataSetObserver@Deprecated public SQLiteCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query)
SQLiteCursor(SQLiteCursorDriver, String, SQLiteQuery) insteadSELECT name, birth, phone FROM
myTable WHERE ... LIMIT 1,20 ORDER BY... the column names (name, birth,
phone) would be in the projection argument and everything from
FROM onward would be in the params argument.db - a reference to a Database object that is already constructed
and opened. This param is not used any longereditTable - the name of the table used for this queryquery - the rest of the query terms
cursor is finalizedpublic SQLiteCursor(SQLiteCursorDriver driver, String editTable, SQLiteQuery query)
SELECT name, birth, phone FROM
myTable WHERE ... LIMIT 1,20 ORDER BY... the column names (name, birth,
phone) would be in the projection argument and everything from
FROM onward would be in the params argument.editTable - the name of the table used for this queryquery - the SQLiteQuery object associated with this cursor object.public SQLiteDatabase getDatabase()
public boolean onMove(int oldPosition,
int newPosition)
AbstractCursoronMove in interface CrossProcessCursoronMove in class AbstractCursoroldPosition - the position that we're moving fromnewPosition - the position that we're moving topublic int getCount()
CursorgetCount in interface CursorgetCount in class AbstractCursorpublic int getColumnIndex(String columnName)
CursorCursor.getColumnIndexOrThrow(String) instead, which
will make the error more clear.getColumnIndex in interface CursorgetColumnIndex in class AbstractCursorcolumnName - the name of the target column.Cursor.getColumnIndexOrThrow(String)public String[] getColumnNames()
CursorgetColumnNames in interface CursorgetColumnNames in class AbstractCursorpublic void deactivate()
CursorCursor.requery() is called.
Inactive Cursors use fewer resources than active Cursors.
Calling Cursor.requery() will make the cursor active again.deactivate in interface Cursordeactivate in class AbstractCursorpublic void close()
CursorCursor.deactivate() a call to Cursor.requery() will not make the Cursor valid
again.close in interface Cursorclose in interface Closeableclose in interface AutoCloseableclose in class AbstractCursorpublic boolean requery()
CursorCursor.deactivate().
Since this method could execute a query on the database and potentially take
a while, it could cause ANR if it is called on Main (UI) thread.
A warning is printed if this method is being executed on Main thread.requery in interface Cursorrequery in class AbstractCursorpublic void setWindow(CursorWindow window)
AbstractWindowedCursorThe cursor takes ownership of the provided cursor window; the cursor window will be closed when the cursor is closed or when the cursor adopts a new cursor window.
If the cursor previously had a cursor window, then it is closed when the new cursor window is assigned.
setWindow in class AbstractWindowedCursorwindow - The new cursor window, typically a remote cursor window.public void setSelectionArguments(String[] selectionArgs)
protected void finalize()
finalize in class AbstractCursor