library / org.akop.kotx.ext.database / android.database.Cursor

Extensions for android.database.Cursor

get

operator fun <T> Cursor.get(columnIndex: Int): T?

Generic version of Cursor.getString, Cursor.getNullableShort, Cursor.getNullableInt, Cursor.getNullableLong, Cursor.getNullableFloat, Cursor.getNullableDouble, and Cursor.getBlob.

getNullableDouble

fun Cursor.getNullableDouble(columnIndex: Int, defaultValue: Double? = null): Double?

Same as Cursor.getDouble, but returns defaultValue when the column value is NULL.

getNullableFloat

fun Cursor.getNullableFloat(columnIndex: Int, defaultValue: Float? = null): Float?

Same as Cursor.getFloat, but returns defaultValue when the column value is NULL.

getNullableInt

fun Cursor.getNullableInt(columnIndex: Int, defaultValue: Int? = null): Int?

Same as Cursor.getInt, but returns defaultValue when the column value is NULL.

getNullableLong

fun Cursor.getNullableLong(columnIndex: Int, defaultValue: Long? = null): Long?

Same as Cursor.getLong, but returns defaultValue when the column value is NULL.

getNullableShort

fun Cursor.getNullableShort(columnIndex: Int, defaultValue: Short? = null): Short?

Same as Cursor.getShort, but returns defaultValue when the column value is NULL.