Build 1.0_r1(from source)

android.database.sqlite
Class SQLiteCursor

java.lang.Object
  extended by android.database.AbstractCursor
      extended by android.database.AbstractWindowedCursor
          extended by android.database.sqlite.SQLiteCursor
All Implemented Interfaces:
CrossProcessCursor, Cursor

public class SQLiteCursor
extends AbstractWindowedCursor

A Cursor implementation that exposes results from a query on a SQLiteDatabase.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.database.AbstractCursor
AbstractCursor.SelfContentObserver
 
Field Summary
(package private) static int NO_COUNT
           
(package private) static String TAG
           
 
Fields inherited from class android.database.AbstractWindowedCursor
mWindow
 
Fields inherited from class android.database.AbstractCursor
mClosed, mContentResolver, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRows
 
Constructor Summary
SQLiteCursor(SQLiteDatabase db, SQLiteCursorDriver driver, String editTable, SQLiteQuery query)
          Execute a query and provide access to its result set through a Cursor interface.
 
Method Summary
 void close()
          Closes the Cursor, releasing all of its resources and making it completely invalid.
 boolean commitUpdates(Map<? extends Long,? extends Map<String,Object>> additionalValues)
          Deprecated.  
 void deactivate()
          Deactivates the Cursor, making all calls on it fail until Cursor.requery() is called.
 boolean deleteRow()
          Deprecated.  
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()
           
 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)
          Set a new cursor window to cursor, usually set a remote cursor window
 boolean supportsUpdates()
          Deprecated.  
 
Methods inherited from class android.database.AbstractWindowedCursor
checkPosition, copyStringToBuffer, getBlob, getDouble, getFloat, getInt, getLong, getShort, getString, getWindow, hasWindow, isBlob, isNull
 
Methods inherited from class android.database.AbstractCursor
abortUpdates, commitUpdates, deactivateInternal, fillWindow, getColumnCount, getColumnIndexOrThrow, getColumnName, getExtras, getPosition, getUpdatedField, getWantsAllOnMoveCalls, hasUpdates, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, registerContentObserver, registerDataSetObserver, respond, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver, update, updateBlob, updateDouble, updateFloat, updateInt, updateLong, updateShort, updateString, updateToNull
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

static final String TAG
See Also:
Constant Field Values

NO_COUNT

static final int NO_COUNT
See Also:
Constant Field Values
Constructor Detail

SQLiteCursor

public SQLiteCursor(SQLiteDatabase db,
                    SQLiteCursorDriver driver,
                    String editTable,
                    SQLiteQuery query)
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
Method Detail

getDatabase

public SQLiteDatabase getDatabase()
Returns:
the SQLiteDatabase that this cursor is associated with.

onMove

public boolean onMove(int oldPosition,
                      int newPosition)
Description copied from class: AbstractCursor
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.

Specified by:
onMove in interface CrossProcessCursor
Overrides:
onMove in class AbstractCursor
Parameters:
oldPosition - the position that we're moving from
newPosition - the position that we're moving to
Returns:
true if the move is successful, false otherwise

getCount

public int getCount()
Description copied from interface: Cursor
Returns the numbers of rows in the cursor.

Specified by:
getCount in interface Cursor
Specified by:
getCount in class AbstractCursor
Returns:
the number of rows in the cursor.

getColumnIndex

public int getColumnIndex(String columnName)
Description copied from interface: Cursor
Returns the zero-based index for the given column name, or -1 if the column doesn't exist. If you expect the column to exist use Cursor.getColumnIndexOrThrow(String) instead, which will make the error more clear.

Specified by:
getColumnIndex in interface Cursor
Overrides:
getColumnIndex in class AbstractCursor
Parameters:
columnName - the name of the target column.
Returns:
the zero-based column index for the given column name, or -1 if the column name does not exist.
See Also:
Cursor.getColumnIndexOrThrow(String)

deleteRow

public boolean deleteRow()
Deprecated. 

Description copied from interface: Cursor
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.

The query must have the row ID column in its selection, otherwise this call will fail.

Specified by:
deleteRow in interface Cursor
Overrides:
deleteRow in class AbstractCursor
Returns:
whether the record was successfully deleted.

getColumnNames

public String[] getColumnNames()
Description copied from interface: Cursor
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.

Specified by:
getColumnNames in interface Cursor
Specified by:
getColumnNames in class AbstractCursor
Returns:
the names of the columns returned in this query.

supportsUpdates

public boolean supportsUpdates()
Deprecated. 

Description copied from interface: Cursor
Returns true if the cursor supports updates.

Specified by:
supportsUpdates in interface Cursor
Overrides:
supportsUpdates in class AbstractCursor
Returns:
whether the cursor supports updates.

commitUpdates

public boolean commitUpdates(Map<? extends Long,? extends Map<String,Object>> additionalValues)
Deprecated. 

Description copied from interface: Cursor
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 Cursor.requery() before reading data from the cursor again.

Specified by:
commitUpdates in interface Cursor
Overrides:
commitUpdates in class AbstractCursor
Parameters:
additionalValues - A map from row IDs to Maps associating column names with updated values. A null value indicates the field should be removed.
Returns:
whether the operation succeeded.

deactivate

public void deactivate()
Description copied from interface: Cursor
Deactivates the Cursor, making all calls on it fail until Cursor.requery() is called. Inactive Cursors use fewer resources than active Cursors. Calling Cursor.requery() will make the cursor active again.

Specified by:
deactivate in interface Cursor
Overrides:
deactivate in class AbstractCursor

close

public void close()
Description copied from interface: Cursor
Closes the Cursor, releasing all of its resources and making it completely invalid. Unlike Cursor.deactivate() a call to Cursor.requery() will not make the Cursor valid again.

Specified by:
close in interface Cursor
Overrides:
close in class AbstractCursor

requery

public boolean requery()
Description copied from interface: Cursor
Performs the query that created the cursor again, refreshing its contents. This may be done at any time, including after a call to Cursor.deactivate().

Specified by:
requery in interface Cursor
Overrides:
requery in class AbstractCursor
Returns:
true if the requery succeeded, false if not, in which case the cursor becomes invalid.

setWindow

public void setWindow(CursorWindow window)
Description copied from class: AbstractWindowedCursor
Set a new cursor window to cursor, usually set a remote cursor window

Overrides:
setWindow in class AbstractWindowedCursor
Parameters:
window - cursor window

setSelectionArguments

public void setSelectionArguments(String[] selectionArgs)
Changes the selection arguments. The new values take effect after a call to requery().


finalize

protected void finalize()
Release the native resources, if they haven't been released yet.

Overrides:
finalize in class AbstractCursor

Build 1.0_r1(from source)

Please submit a feedback, bug or feature