Check for values being converted when stored in SQLite

SQLite Banner

I hit an annoying problem when testing my Android app on one of my devices (running Android 4.2.2), where values saved into the SQLite database are converted in certain cases.

This is most likely a SQLite issue, but can’t confirm it

So, I created a column in my SQLite Table called “IsInStock“. The Web API I call to fetch and store data in this table provides a property “inStock” with a string value of “1” or “0“. My app’s code checks for these values when running queries.

On iOS, the values remain as “1” and “0” in the table column, but on my Android device (Android 4.2.2), these values are converted to string values of “true” and “false“. I’m not sure why this is happening and haven’t invested the time to dig deeper. A workaround I went with for now is to extend my SQLite queries to check also for “true” or “false” when checking for “1” or “0“.

Cheers for now.

Leave a comment

Your email address will not be published. Required fields are marked *