SQLiteCursor
open class SQLiteCursor : AbstractWindowedCursor
A Cursor implementation that exposes results from a query on a SQLiteDatabase
. SQLiteCursor is not internally synchronized so code using a SQLiteCursor from multiple threads should perform its own synchronization when using the SQLiteCursor.
Summary
Public constructors |
Execute a query and provide access to its result set through a Cursor interface.
|
Execute a query and provide access to its result set through a Cursor interface.
|
Protected methods |
open Unit |
Release the native resources, if they haven't been released yet.
|
Inherited functions |
|
From class AbstractCursor
Unit |
close()
|
Unit |
deactivate()
|
Unit |
fillWindow(position: Int, window: CursorWindow!)
|
Unit |
finalize()
|
Int |
getColumnCount()
|
Int |
getColumnIndex(columnName: String!)
|
Int |
getColumnIndexOrThrow(columnName: String!)
|
String! |
getColumnName(columnIndex: Int)
|
Array<String!>! |
getColumnNames()
|
Int |
getCount()
|
Bundle! |
getExtras()
|
Uri! |
getNotificationUri()
|
MutableList<Uri!>? |
getNotificationUris()
|
Int |
getPosition()
|
Any! |
getUpdatedField(columnIndex: Int)
|
Boolean |
getWantsAllOnMoveCalls()
|
Boolean |
isAfterLast()
|
Boolean |
isBeforeFirst()
|
Boolean |
isClosed()
|
Boolean |
isFieldUpdated(columnIndex: Int)
|
Boolean |
isFirst()
|
Boolean |
isLast()
|
Boolean |
move(offset: Int)
|
Boolean |
moveToFirst()
|
Boolean |
moveToLast()
|
Boolean |
moveToNext()
|
Boolean |
moveToPosition(position: Int)
|
Boolean |
moveToPrevious()
|
Unit |
onChange(selfChange: Boolean)
Subclasses must call this method when they finish committing updates to notify all observers.
|
Boolean |
onMove(oldPosition: Int, newPosition: Int)
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.
|
Unit |
registerContentObserver(observer: ContentObserver!)
|
Unit |
registerDataSetObserver(observer: DataSetObserver!)
|
Boolean |
requery()
|
Bundle! |
respond(extras: Bundle!)
|
Unit |
setExtras(extras: Bundle!)
|
Unit |
setNotificationUri(cr: ContentResolver!, notifyUri: Uri!)
Specifies a content URI to watch for changes.
|
Unit |
setNotificationUris(cr: ContentResolver, notifyUris: MutableList<Uri!>)
Similar to setNotificationUri(android.content.ContentResolver,android.net.Uri) , except this version allows to watch multiple content URIs for changes.
If this is not implemented, this is equivalent to calling setNotificationUri(android.content.ContentResolver,android.net.Uri) with the first URI in uris .
Calling this overrides any previous call to setNotificationUri(android.content.ContentResolver,android.net.Uri) .
|
Unit |
unregisterContentObserver(observer: ContentObserver!)
|
Unit |
unregisterDataSetObserver(observer: DataSetObserver!)
|
|
Public constructors
SQLiteCursor
SQLiteCursor(
driver: SQLiteCursorDriver!,
editTable: String!,
query: SQLiteQuery!)
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.
Parameters |
editTable |
String!: the name of the table used for this query |
query |
SQLiteQuery!: the SQLiteQuery object associated with this cursor object. |
SQLiteCursor
SQLiteCursor(
db: SQLiteDatabase!,
driver: SQLiteCursorDriver!,
editTable: String!,
query: SQLiteQuery!)
Deprecated: use SQLiteCursor(android.database.sqlite.SQLiteCursorDriver,java.lang.String,android.database.sqlite.SQLiteQuery)
instead
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.
Parameters |
db |
SQLiteDatabase!: a reference to a Database object that is already constructed and opened. This param is not used any longer |
editTable |
String!: the name of the table used for this query |
query |
SQLiteQuery!: the rest of the query terms cursor is finalized |
Public methods
close
open fun close(): Unit
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
deactivate
open fun deactivate(): Unit
getColumnIndex
open fun getColumnIndex(columnName: String!): Int
Parameters |
columnName |
String!: the name of the target column. |
Return |
Int |
the zero-based column index for the given column name, or -1 if the column name does not exist. Value is -1 or greater |
getColumnNames
open fun getColumnNames(): Array<String!>!
Return |
Array<String!>! |
the names of the columns returned in this query. |
getCount
open fun getCount(): Int
Return |
Int |
the number of rows in the cursor. Value is 0 or greater |
getDatabase
open fun getDatabase(): SQLiteDatabase!
Get the database that this cursor is associated with.
Return |
SQLiteDatabase! |
the SQLiteDatabase that this cursor is associated with. |
onMove
open fun onMove(
oldPosition: Int,
newPosition: Int
): Boolean
Parameters |
oldPosition |
Int: the position that we're moving from |
newPosition |
Int: the position that we're moving to |
Return |
Boolean |
true if the move is successful, false otherwise |
requery
open fun requery(): Boolean
Return |
Boolean |
true if the requery succeeded, false if not, in which case the cursor becomes invalid. |
setFillWindowForwardOnly
open fun setFillWindowForwardOnly(fillWindowForwardOnly: Boolean): Unit
Controls fetching of rows relative to requested position.
Calling this method defines how rows will be loaded, but it doesn't affect rows that are already in the window. This setting is preserved if a new window is set
Parameters |
fillWindowForwardOnly |
Boolean: if true, rows will be fetched starting from requested position up to the window's capacity. Default value is false. |
setSelectionArguments
open fun setSelectionArguments(selectionArgs: Array<String!>!): Unit
Changes the selection arguments. The new values take effect after a call to requery().
setWindow
open fun setWindow(window: CursorWindow!): Unit
Parameters |
window |
CursorWindow!: The new cursor window, typically a remote cursor window. |
Protected methods
finalize
protected open fun finalize(): Unit
Release the native resources, if they haven't been released yet.
Exceptions |
java.lang.Throwable |
the Exception raised by this method |