James, thanks for that update. I've filed a new ticket for this issue,
#1096 (http://www.sqlite.org/cvstrac/tktview?tn=1096). I hope you don't
mind that I quoted your response and implementation suggestion in the
body of that ticket.
-Eric
James Berry wrote:
Eric,
No, you're not missing anything. I asked this same question about a
month ago. Dr. Hipp replied that argument substitution is not allowed
in those cases, because it's allowed only where any of the datatypes
allowed for substitution would be legal (blob, int, string, null). As
limit and offset take only integers, the prepared statement parser
wouldn't know ahead of time that the syntax was correct.
While I understand that argument, I, too, think this is unfortunate. I
wonder if this could be relaxed such the arguments would simply be
coerced at execution time into integer, no matter what the actual
argument type.
-jdb
On Feb 1, 2005, at 8:41 PM, Eric Scouten wrote:
When I attempt to prepare the following statement using sqlite3_prepare:
SELECT id FROM testEntity LIMIT 5 OFFSET ?;
I get the following error back from SQLite:
near "?": syntax error
Is this really not allowed? If so, that seems a bit odd to me. This
seems like a classic use-case for prepared statements (re-running the
same query with different offsets).
Or is there something else I'm missing?
-Eric
(FWIW, I'm using SQLite 3.0.8 on Mac OS X.)