Back ticks & Capitals


I must admit that your book made me finally look at SQLite thing and see what is this library all about. So far I was always skipping SQL chapters in other iPhone books and I even have ‘The Definitive Guide to SQLite’ by Apress, which I skipped completely. So, now I read your SQL chapter and all the other SQL chapters in other iPhone books. Even the ‘Definitive Guide’ turned out very handy.

As I opened countries.sql file in Xcode I noticed you have back ticks around field names. So far I have never seen it, so I googled a bit and found this thread at stackoverflow, so it is a bit clearer now. Did you create those sql statements by hand or with some generator? Author of one book used an add-on for Firefox to manage SQLite. Are you maybe using it too?

And the other thing I noticed, one of the fields is named Capital, yet when you insert values into database you have numbers for that field. Maybe you had cities in some other table, but you had to shorten the example for the book, or something like that?

Another minor detail, on page 339, if sqlite3_prepare_v2() doesn’t return SQLITE_OK you NSLog the error message, but then continue with the task. Maybe a return keyword would be appropriate here.


We use the command-line tool sqlite3 to manage the database.

I think Aaron found this open source countries database somewhere, I’ll have to ask him about the numbers in the capitals field (which might be unique ids for another table) and the chunk of code you’re talking about. (As you can see, I didn’t write this chapter. :slight_smile: