Yes, it's impossible to replace table or column names. You can replace
any constant values like this:

select table.column2, column3 + ?
from table
where column1 = ? and column2 + ? > column3
limit ?, ?

Pavel

On Fri, Jun 19, 2009 at 10:06 AM, Shaun Seckman
(Firaxis)<[email protected]> wrote:
> Not sure I fully understand what you mean.  Is it not possible to replace the 
> table name in the prepared statement?  What sort of things can I replace then?
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Pavel Ivanov
> Sent: Friday, June 19, 2009 10:03 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Literal replacements in prepared statements
>
> You're trying identifier replacement, not literal replacement. It's
> not allowed. You have to write table name without binding.
>
> Pavel
>
> On Fri, Jun 19, 2009 at 9:58 AM, Shaun Seckman
> (Firaxis)<[email protected]> wrote:
>> I'm trying to add some literal replacements in my prepared SQL statement
>> but I'm currently getting a SQL syntax error.
>>
>> Here's a snippit of what I'm trying to do:
>>
>>
>>
>> ...
>>
>> sqlite3_stmt* stmt;
>>
>> sqlite3_prepare_v2(db, "Select * from ?", -1, &stmt, NULL);   <-- near
>> "?": syntax error
>>
>> sqlite3_bind_text(stmt, 1, tableName, -1, SQLITE_TRANSIENT);
>>
>> ...
>>
>>
>>
>> Any idea what I'm doing wrong?
>>
>>
>>
>> -Shaun
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> [email protected]
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to