I just realized that one of my database insert() commands failed due to violation of a not null constraint - I just filled no data into this field.
Problem is, it took me ages to find out why this insert returned -1, because I could not find an error or Exception anywhere.
I'd expect, and I guess for more complex databases and query, it's totally important, to have somewhere some information from the database what's really going on that makes the DB access fail, but I could not find any information on this anywhere.
I found that one can use insertOrThrow() instead of insert, at least you get an exception when, something goes wrong, saying android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed - even though I actually would wish/expect it would be even clearer and tell me which column has an error or so, but maybe I'm too demanding about SQLIte's feaures here.
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