PreparedStatement\\LR confusion

I’m looking at the LR for SQLitePreparedStatement and I don’t understand how the first 2 bits of code are valid \ invalid prepared statements.

Are these ‘auto’ prepared statements? To me it just looks like a string replacement like I’d do in C#. If they are prepared statements and not just Select calls can “USA” be replaced with “O’Reilly” or 17 or True ?

I know I could be reading it all wrong, won’t be the first time.

I presume you are referring to this section:

[quote]For example, this is an invalid prepared statement because of the single quotes:

rs = App.DB.SQLSelect("SELECT * FROM Customers WHERE Country = '?'", "USA") // Invalid!

This is valid:

rs = app.db.SQLSelect("SELECT * from Customers WHERE Country = ?", "USA") // Valid!


It looks like there is a typo there and it should be “App.DB.Prepare”, not “App.DB.SQLSelect”. Thanks for noticing that! I’ve updated the page.

Thanks Paul Lefebvre though I’m still a little confused about the [, “USA”]. Typo as well?

Yup, I see the problem. That code was using the syntax for a prepared statement using iOSSQLiteDatabase, which works a bit differently.