mardi 1 décembre 2015

Return value of sqlite insertWithOnConflict?

I am trying to understand the return value of SQLiteDatabase.insertWithOnConflict.

My code is like:

long result = db.insertWithOnConflict(
                MyTable.TABLE_NAME,
                null,
                initialValues,
                SQLiteDatabase.CONFLICT_IGNORE);

The doc for insertWithOnConflict says:

Returns: the row ID of the newly inserted row OR the primary key of the existing row if the input param 'conflictAlgorithm' = CONFLICT_IGNORE OR -1 if any error

What if the primary key of MyTable is a TEXT type? When insert conflict happens, how can it return the primary key of the existing row, which is a TEXT value, to a long variable?

Thanks.

Aucun commentaire:

Enregistrer un commentaire