Reference:Android.database.sqlite.SQLiteCursor
From Triled Wiki
android.database.sqlite
public class android.database.sqlite.SQLiteCursor
| java.lang.Object | ||||
| android.database.AbstractCursor | Cursor | |||
| android.database.AbstractWindowedCursor | ||||
| android.database.sqlite.SQLiteCursor | ||||
[edit] Known Direct Subclasses
DatabaseContentProvider.DcpCursor
[edit] Summary
[edit] Fields inherited from class android.database.AbstractWindowedCursor
mWindow[edit] Fields inherited from class android.database.AbstractCursor
mContentResolver, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRows
[edit] Public Constructors
| SQLiteCursor (SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query, int count) | |||||
| Execute a query and provide access to its result set through a Cursor interface. | |||||
[edit] Public Methods
| void | close () | ||||
| Closes the Cursor, releasing all of its resources and making it completely invalid. | |||||
| boolean | >)">commitUpdates (Map additionalValues) | ||||
| Atomically commits all updates to the backing store, as well as the updates included in values. | |||||
| int | count () | ||||
| Returns the numbers of rows in the cursor. | |||||
| void | deactivate () | ||||
| Deactivates the Cursor, making all calls on it fail until requery() is called. | |||||
| boolean | deleteRow () | ||||
| Removes the row at the current cursor position from the underlying data store. | |||||
| int | getColumnIndex (String columnName) | ||||
| Returns the zero-based index for the given column name. | |||||
| 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. | |||||
| boolean | requery () | ||||
| Performs the query that created the cursor again, refreshing its contents. | |||||
| boolean | supportsUpdates () | ||||
| Returns true if the cursor supports updates. | |||||
[edit] Protected Methods
| boolean | >, boolean)">commitUpdatesInternal (Map additionalValues, boolean useATransaction) | ||||
| void | finalize () | ||||
| Release the native resources, if they haven't been released yet. | |||||
| 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. | |||||
| void | setSelectionArguments (String[ ] selectionArgs) | ||||
| Subclasses may change the selection arguments used by the cursor. | |||||
[edit] Methods inherited from class android.database.AbstractWindowedCursor
checkPosition, getDouble, getFloat, getInt, getLong, getShort, getString, isNull[edit] Methods inherited from class android.database.AbstractCursor
abortUpdates, checkPosition, close, >)">commitUpdates, commitUpdates, count, deactivate, deleteRow, finalize, first, getColumnIndex, getColumnName, getColumnNames, getDouble, getExtras, getFloat, getInt, getLong, getShort, getString, getUpdatedField, getWantsAllOnMoveCalls, hasUpdates, isAfterLast, isBeforeFirst, isFieldUpdated, isFirst, isLast, isNull, last, move, moveTo, next, onChange, onMove, position, prev, registerContentObserver, registerDataSetObserver, requery, respond, setNotificationUri, supportsUpdates, unregisterContentObserver, unregisterDataSetObserver, update, updateDouble, updateFloat, updateInt, updateLong, updateShort, updateString, updateToNull[edit] Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait[edit] Methods inherited from interface android.database.Cursor
abortUpdates, close, >)">commitUpdates, commitUpdates, count, deactivate, deleteRow, first, getColumnIndex, getColumnName, getColumnNames, getDouble, getExtras, getFloat, getInt, getLong, getShort, getString, getWantsAllOnMoveCalls, hasUpdates, isAfterLast, isBeforeFirst, isFirst, isLast, isNull, last, move, moveTo, next, position, prev, registerContentObserver, registerDataSetObserver, requery, respond, setNotificationUri, supportsUpdates, unregisterContentObserver, unregisterDataSetObserver, updateDouble, updateFloat, updateInt, updateLong, updateShort, updateString, updateToNull
[edit] Details
[edit] Public Constructors
[edit] public SQLiteCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query, int count)
Execute a query and provide access to its result set through a Cursor interface. For a query such as: 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. This constructor has package scope.
Parameters
| db | a reference to a Database object that is already constructed and opened |
|---|---|
| editTable | the name of the table used for this query |
| query | the rest of the query terms cursor is finalized |
[edit] Public Methods
[edit] public void close()
Closes the Cursor, releasing all of its resources and making it completely invalid. Unlike deactivate() a call to requery() will not make the Cursor valid again.
[edit] public boolean commitUpdates(Map additionalValues)
Atomically commits all updates to the backing store, as well as the updates included in values. After completion, this method leaves the data in an inconsistent state and you should call requery() before reading data from the cursor again.
[edit] public int count()
Returns the numbers of rows in the cursor.
[edit] public void deactivate()
Deactivates the Cursor, making all calls on it fail until requery() is called. Inactive Cursors use fewer resources than active Cursors. Calling requery() will make the cursor active again.
[edit] public boolean deleteRow()
Removes the row at the current cursor position from the underlying data store. After this method returns the cursor will be pointing to the row after the row that is deleted. This has the side effect of decrementing the result of count() by one.
[edit] public int getColumnIndex(String columnName)
Returns the zero-based index for the given column name.
[edit] public 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.
[edit] public boolean requery()
Performs the query that created the cursor again, refreshing its contents. This may be done at any time, including after a call to deactivate().
[edit] public boolean supportsUpdates()
Returns true if the cursor supports updates.
[edit] Protected Methods
[edit] protected boolean commitUpdatesInternal(Map additionalValues, boolean useATransaction)
[edit] protected void finalize()
Release the native resources, if they haven't been released yet.
[edit] protected 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. If it returns false the move function will also do so and the cursor will scroll to the beforeFirst position.
Parameters
| oldPosition | the position that we're moving from |
|---|---|
| newPosition | the position that we're moving to |
[edit] protected void setSelectionArguments(String[ ] selectionArgs)
Subclasses may change the selection arguments used by the cursor. The new values take effect after a call to requery().
[edit] References
- Original documentation page for Android SDK build m5-rc15e - 14 apr 2008 17:27
