I’ll spend some time writing some (raw) SQL statements in Android (e.g. for creating some tables) and I can only verify that my statements are correct when I try to run the app and check the logs. Seems like a rather complicated way of discovering that I forgot a comma somewhere and I’m thinking there has to be a better way to do this.
So what I would like to do:
-
At the very least, I would like to have a way of easily checking that my SQL syntax is correct (like a compile check).
-
Ideally I’m wondering what the easiest way to execute and test all my SQL queries is when working with Android. Obviously I could setup my own SQLite instance independent of the Android one and just execute the queries there, but I’m wondering what other solutions people have.
You can use
adb shell. Then inside of the shell, you can usesqlite3.Read this for more details: http://developer.android.com/guide/developing/tools/adb.html#shellcommands
Here’s a relevant excerpt:
Also, if you want to see a live demo of a Google engineer doing this exact thing, watch the Writing Zippy Android Apps session from Google I/O 2010 and start watching around the 9:00 mark.