The docs say:
The result and whether this method throws an exception when the column value is null or the column type is not a string type is implementation-defined.
Which implementation are they talking about? The version of sqlite? Will calling
cursor.getString(INT_COLUMN)
coerce the int
value into a String
?
Cursors are what contain the result set of a query made against a database in Android. The Cursor class has an API that allows an app to read (in a type-safe manner) the columns that were returned from the query as well as iterate over the rows of the result set.
The basic purpose of a cursor is to point to a single row of the result fetched by the query. We load the row pointed by the cursor object. By using cursor we can save lot of ram and memory. Here, we pass the table name, column name only then we receive the cursor.
Does cursor.getString() coerce an int into a string?
Yes, the same data from your table can be returned with getString()
, getInt()
, getLong()
, etc as long as it makes sense. For example,
getInt()
returns 42 and getString()
returns "42".getString()
returns "plant", getInt()
returns 0.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With