Error #3132 in AIR and SQLite

I recently working on an AIR for Android application, I encountered this error while trying to save a suer setting:

SQLError: ‘Error #3132: Data type mismatch.’, details:’could not convert text value to numeric value.

I looked over the SQL query I was making, and it seemed correct. So I began the process of trying to isolate the cause. I traced out the variables and they were correct. So, I replaced the variables with static values, and tried yet again. No luck, the same error. A quick search on Google did not seem reveal a clue as to what was going on.

I open the database I was working with using SQLite Database Browser 1.3. I tested the SQL query, and no errors were reported.  I was extremely puzzled. I trying to update a NUMERIC column with the value 0. I try forcing the variables before I ran the query in my app. But still I would get the same error.

Then I looked over all the columns in that row, and noticed that in one column set to NUMERIC, there was a dash. It seems that SQLite Database Browser had allowed an invalid entry into that column. Mind you this was not the column I was trying to update, so I did not notice it. I changed the value from the dash to a number, saved the database, recompiled the application, and it worked! WooT!

It seems that the SQLite engine use in AIR is very strict (or SQLite Database Browser is not), it will check that all the columns have legal values in them for an UPDATE query. This was not something I expected.

I have since switched to Lita (http://adobeair.me/lita/). Since it is built on Adobe AIR, I can feel confident that my queries will run in my AIR applications.

About these ads

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s