Stay organized with collections Save and categorize content based on your preferences.
SQLiteStatement
class SQLiteStatement : SQLiteProgram
Represents a statement that can be executed against a database. The statement cannot return multiple rows or columns, but single value (1 x 1) result sets are supported.
This class is not thread-safe.
Summary
Public methods |
Unit | Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc. |
Long | Execute this SQL statement and return the ID of the row inserted due to this call. |
Int | Execute this SQL statement, if the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements. |
ParcelFileDescriptor! | Executes a statement that returns a 1 by 1 table with a blob value. |
Long | Execute a statement that returns a 1 by 1 table with a numeric value. |
String! | Execute a statement that returns a 1 by 1 table with a text value. |
String | |
Public methods
execute
fun execute(): Unit
Execute this SQL statement, if it is not a SELECT / INSERT / DELETE / UPDATE, for example CREATE / DROP table, view, trigger, index etc.
Exceptions |
android.database.SQLException | If the SQL string is invalid for some reason |
executeInsert
fun executeInsert(): Long
Execute this SQL statement and return the ID of the row inserted due to this call. The SQL statement should be an INSERT for this to be a useful call.
Return |
Long | the row ID of the last row inserted, if this insert is successful. -1 otherwise. |
Exceptions |
android.database.SQLException | If the SQL string is invalid for some reason |
executeUpdateDelete
fun executeUpdateDelete(): Int
Execute this SQL statement, if the number of rows affected by execution of this SQL statement is of any importance to the caller - for example, UPDATE / DELETE SQL statements.
Return |
Int | the number of rows affected by this SQL statement execution. |
Exceptions |
android.database.SQLException | If the SQL string is invalid for some reason |
simpleQueryForBlobFileDescriptor
fun simpleQueryForBlobFileDescriptor(): ParcelFileDescriptor!
Executes a statement that returns a 1 by 1 table with a blob value.
Return |
ParcelFileDescriptor! | A read-only file descriptor for a copy of the blob value, or null if the value is null or could not be read for some reason. |
Exceptions |
android.database.sqlite.SQLiteDoneException | if the query returns zero rows |
simpleQueryForLong
fun simpleQueryForLong(): Long
Execute a statement that returns a 1 by 1 table with a numeric value. For example, SELECT COUNT(*) FROM table;
Return |
Long | The result of the query. |
Exceptions |
android.database.sqlite.SQLiteDoneException | if the query returns zero rows |
simpleQueryForString
fun simpleQueryForString(): String!
Execute a statement that returns a 1 by 1 table with a text value. For example, SELECT COUNT(*) FROM table;
Return |
String! | The result of the query. |
Exceptions |
android.database.sqlite.SQLiteDoneException | if the query returns zero rows |
toString
fun toString(): String
Return |
String | a string representation of the object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]