Hi,

you cannot bind the name of a table. Bind variables only work for Values 
in the database, like you used in the VALUES('1', ?) - clause.
Names of tables, columns or other items of the schema must be written in 
the sql statement.
You will have to build your statement (using sprintf() or similar) 
before preparig it.

This is not uniqe to sqlite, but to SQL in general.

Martin

Am 19.05.2011 10:04, schrieb Dev_lex:
> Hello,
>
> I've a little question about sqlite3_prepare_v2 :
>
> I would like to do this :
>
>    const char   *zSql = "INSERT INTO ?(ID, MyData) VALUES('1',?)";
>
>   if(ppStmt)
>    {
>        sqlite3_bind_parameter_name(ppStmt, "atest");
>        sqlite3_bind_blob(ppStmt, 2,&blob, sizeof(blob), SQLITE_TRANSIENT);
>        sqlite3_step(ppStmt);
>        sqlite3_finalize(ppStmt);
>    }
>
> So then I've just to bind values.. It works great for the second '?' which
> is a blob, so bind_blob(), but for the first one I don't really know what to
> use ?
>
> Maybe the '?' syntax is incorrect? I've not understood everything about it..
>
> Regards
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to