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

optQuery

fun SQLiteDatabase.optQuery(table: String, columns: Array<String>? = null, selection: String? = null, selArgs: Array<String>? = null, groupBy: String? = null, having: String? = null, orderBy: String? = null, limit: String? = null): Cursor

Slightly more concise version of SQLiteDatabase.query that allows omission of most fields by use of named parameters.

See SQLiteDatabase.query for more information.

Parameters

table - Table referenced in the query.

columns - List of columns to return (null to return all - not recommended).

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.

limit - LIMIT clause, excluding 'LIMIT' itself. Pass null to disable limit.

Return
Cursor object, positioned before the first query.