library / org.akop.kotx.ext.database / android.database.sqlite.SQLiteDatabase / queryValue

queryValue

inline fun <reified T> SQLiteDatabase.queryValue(table: String, column: String, selection: String? = null, selArgs: Array<String>? = null, groupBy: String? = null, having: String? = null, orderBy: String? = null, defaultValue: T? = null): T?

Queries for a single column value in a single row. Automatically sets a LIMIT of 1 for any query submitted

Parameters

table - Table referenced in the query.

column - Name of column to query.

selection - Selection query - contents of WHERE clause - excluding WHERE itself.

selArgs - A string to replace for each '?' found in selection.

groupBy - GROUP BY clause - excluding the 'GROUP BY'. May be null to disable grouping.

having - HAVING clause, excluding the 'HAVING'. May be null.

orderBy - ORDER BY clause, excluding the 'ORDER BY'. May be null to return in default order.

Return
Value of the column in the first row of the resulting query.