SQLiteStatement
-
Cmn
interface SQLiteStatement
SQLite statement definition.
A prepared statement is a resource that must be released once it is no longer needed via its close function.
See also Prepared Statement
Summary
Public functions |
||
|---|---|---|
Unit |
Binds a ByteArray value to this statement at an index. |
Cmn
|
open Unit |
bindBoolean(index: @IntRange(from = 1) Int, value: Boolean)Binds a Boolean value to this statement at an index. |
Cmn
|
Unit |
bindDouble(index: @IntRange(from = 1) Int, value: Double)Binds a Double value to this statement at an index. |
Cmn
|
open Unit |
Binds a Float value to this statement at an index. |
Cmn
|
open Unit |
Binds a Int value to this statement at an index. |
Cmn
|
Unit |
Binds a Long value to this statement at an index. |
Cmn
|
Unit |
Binds a NULL value to this statement at an index. |
Cmn
|
Unit |
Binds a String value to this statement at an index. |
Cmn
|
Unit |
Clears all parameter bindings. |
Cmn
|
Unit |
close()Closes the statement. |
Cmn
|
ByteArray |
Returns the value of the column at |
Cmn
|
open Boolean |
getBoolean(index: @IntRange(from = 0) Int)Returns the value of the column at |
Cmn
|
Int |
Returns the number of columns in the result of the statement. |
Cmn
|
String |
getColumnName(index: @IntRange(from = 0) Int)Returns the name of a column at |
Cmn
|
open List<String> |
Returns the name of the columns in the result of the statement ordered by their index. |
Cmn
|
Int |
getColumnType(index: @IntRange(from = 0) Int)Returns the data type of a column at |
Cmn
|
Double |
Returns the value of the column at |
Cmn
|
open Float |
Returns the value of the column at |
Cmn
|
open Int |
Returns the value of the column at |
Cmn
|
Long |
Returns the value of the column at |
Cmn
|
String |
Returns the value of the column at |
Cmn
|
Boolean |
Returns true if the value of the column at |
Cmn
|
Unit |
reset()Resets the prepared statement back to initial state so that it can be re-executed via |
Cmn
|
Boolean |
step()Executes the statement and evaluates the next result row if available. |
Cmn
|
Public functions
bindBlob
fun bindBlob(index: @IntRange(from = 1) Int, value: ByteArray): Unit
Binds a ByteArray value to this statement at an index.
bindBoolean
open fun bindBoolean(index: @IntRange(from = 1) Int, value: Boolean): Unit
Binds a Boolean value to this statement at an index.
bindDouble
fun bindDouble(index: @IntRange(from = 1) Int, value: Double): Unit
Binds a Double value to this statement at an index.
bindFloat
open fun bindFloat(index: @IntRange(from = 1) Int, value: Float): Unit
Binds a Float value to this statement at an index.
bindInt
open fun bindInt(index: @IntRange(from = 1) Int, value: Int): Unit
Binds a Int value to this statement at an index.
bindLong
fun bindLong(index: @IntRange(from = 1) Int, value: Long): Unit
Binds a Long value to this statement at an index.
bindNull
fun bindNull(index: @IntRange(from = 1) Int): Unit
Binds a NULL value to this statement at an index.
bindText
fun bindText(index: @IntRange(from = 1) Int, value: String): Unit
Binds a String value to this statement at an index.
clearBindings
fun clearBindings(): Unit
Clears all parameter bindings. Unset bindings are treated as NULL.
close
fun close(): Unit
Closes the statement.
Once a statement is closed it should no longer be used. Calling this function on an already closed statement is a no-op.
getBlob
fun getBlob(index: @IntRange(from = 0) Int): ByteArray
Returns the value of the column at index as a ByteArray.
| Returns | |
|---|---|
ByteArray |
the value of the column |
getBoolean
open fun getBoolean(index: @IntRange(from = 0) Int): Boolean
Returns the value of the column at index as a Boolean.
| Returns | |
|---|---|
Boolean |
the value of the column |
getColumnCount
fun getColumnCount(): Int
Returns the number of columns in the result of the statement.
| Returns | |
|---|---|
Int |
the number of columns |
getColumnName
fun getColumnName(index: @IntRange(from = 0) Int): String
Returns the name of a column at index in the result of the statement.
| Returns | |
|---|---|
String |
the name of the column |
getColumnNames
open fun getColumnNames(): List<String>
Returns the name of the columns in the result of the statement ordered by their index.
getColumnType
fun getColumnType(index: @IntRange(from = 0) Int): Int
Returns the data type of a column at index in the result of the statement.
The data type can be used to determine the preferred get*() function to be used for the column but other getters may perform data type conversion.
| Returns | |
|---|---|
Int |
the data type of the column |
getDouble
fun getDouble(index: @IntRange(from = 0) Int): Double
Returns the value of the column at index as a Double.
| Returns | |
|---|---|
Double |
the value of the column |
getFloat
open fun getFloat(index: @IntRange(from = 0) Int): Float
Returns the value of the column at index as a Float.
| Returns | |
|---|---|
Float |
the value of the column |
getInt
open fun getInt(index: @IntRange(from = 0) Int): Int
Returns the value of the column at index as a Int.
| Returns | |
|---|---|
Int |
the value of the column |
getLong
fun getLong(index: @IntRange(from = 0) Int): Long
Returns the value of the column at index as a Long.
| Returns | |
|---|---|
Long |
the value of the column |
getText
fun getText(index: @IntRange(from = 0) Int): String
Returns the value of the column at index as a String.
| Returns | |
|---|---|
String |
the value of the column |
isNull
fun isNull(index: @IntRange(from = 0) Int): Boolean
Returns true if the value of the column at index is NULL.
| Returns | |
|---|---|
Boolean |
true if the column value is NULL, false otherwise |
reset
fun reset(): Unit
Resets the prepared statement back to initial state so that it can be re-executed via step. Any parameter bound via the bind*() APIs will retain their value.
step
fun step(): Boolean
Executes the statement and evaluates the next result row if available.
A statement is initially prepared and compiled but is not executed until one or more calls to this function. If the statement execution produces result rows then this function will return true indicating there is a new row of data ready to be read.
| Returns | |
|---|---|
Boolean |
true if there are more rows to evaluate or false if the statement is done executing |