"Jeff Hamilton" <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a complex query that I want to run often and store the results > to a temporary table. I'd like to compile a statement that looks > something like: > > CREATE TEMP TABLE ? AS SELECT * FROM data WHERE value = ?; > > so that I can have multiple threads accessing the results of the query > in various temp tables simultaneously. The above gives me a parse > error on the first ? for the temp table name. Is this a bug, or > something that SQLite can't support? I have also tried compiling a > simple query SELECT * FROM ?; which also gives a parse error. >
A host parameter (a.k.a. "?") can only be used in places where it is legal to put a literal value. You cannot use it as a place holder for program structure. Changing a table in a query can result it radically different compiled code. (Use EXPLAIN to see this.) It is not feasible to recompile the SQL statement in response to a bind(). -- D. Richard Hipp <[EMAIL PROTECTED]> ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------