On Apr 15, 2005, at 4:16 PM, D. Richard Hipp wrote:

On Fri, 2005-04-15 at 15:49 -0700, Cory Nelson wrote:

It seems when a bind a string to "attach ? as dbname", it is never
translated into the final statement.  Is this supposed to happen?

SQLite only allows bound parameters in places where it is legal to put an expression. Remember that bound parameters can be filled in with NULL, integers, floating point numbers, or strings. And so bound parameters can only be used in places were all those values are legal options. You can not use a floating point number, an integer, or a NULL as the name of a database file in an ATTACH statement - that would make no sense. Hence, bound parameters are not allowed in that context.

It would be useful to use bound parameters in such cases.

Might it make sense to coerce the value at runtime into a string value in such a case? I believe a similar restriction (ticket #1096: limit and offset) was recently lifted to allow bound parameters in those cases, where only an integer is allowed.

-jdb

Reply via email to