hey, thanks, i put a cout on the insert query string generated by mprintf. it was actually putting the table name within quotes itself, so putting the extra quotes was not required. now the insert command is not giving any error, but the values did not actually get inserted :(
Dan Kennedy-4 wrote: > > > On Sep 11, 2009, at 4:32 PM, rishabh wrote: > >> >> i have a stream of data coming in with constant table names and data. >> one of the table names contains a '-' (minus sign). it gives error >> while >> creating the table. >> >> SQL error: near "-": syntax error >> something like Create table "t-t" ( a ); works but Create table t-t >> ( a ); >> gives the above error. >> similarly insert into "t-t" values (1); works, but dont know why using >> mprintf it has a problem. :( >> if i use double quotes around the table name, the table gets >> created, but >> then insert on that table does not work. i am using C/C++ to do the >> inserting, creating, updating etc. >> if in mprintf ... i use \"%Q\" ... for the insert statement, it does >> not it >> gives error saying that the table does not exist whereas the table >> has been >> created. > > You should inspect the string returned by sqlite3_mprintf(), either by > printing it out, or looking at it in a debugger. I think you could be > misinterpreting the docs for %Q. > > Dan. > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/SQL-error%3A-near-%22-%22%3A-syntax-error-tp25397896p25399381.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users