Early Sunday morning (or late Saturday night depending on where you were sitting) I released my first app in beta form on the Android Market (Gas Up). Since that time, I've had data trickling in from users, and I noticed a difference between what my server says a particular gas station's name is, and what seems to be getting stored on my users' phones. In particular, someone submitted the gas station name "Loaf & Jug" complete with the ampersand. My database server didn't blink at the ampersand; it stored it properly, and the ampersand is getting sent to the clients properly as well. However, in the database on the emulator and actual devices (my G1 and Nexus One at least), only "Loaf " seems to be getting stored.

Under other circumstances, I would expect that this might have been caused by failing to escape the data before inserting it into the database, but I'm not sure that's the problem here because I know for a fact that it was inserted using ContentValues and SQLiteDatabase's insert() call. While not absolutely guaranteed to be error proof or immune to unescaped string errors, this method has allowed some other characters that need to be escaped into the database without any problems. (Single quotes for example.)

Should I be doing some additional string manipulation/escaping before inserting string values into the SQLite database? A quick search I did on SQLite and the ampersand suggested using question mark/prepared statement form of queries... Would it be better to switch over to that?

Thanks,
Raymond

--
Raymond Rodgers
http://www.badlucksoft.com/

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to