You should use
sprintf(buf, "CREATE TABLE %s(x double, y double)", tableName);
then use prepare and execute using from that string.
----- Original Message -----
From: "Mike McGonagle" <[email protected]>
To: "General Discussion of SQLite Database" <[email protected]>
Sent: Tuesday, January 13, 2009 3:43 AM
Subject: [sqlite] Is this legal SQL?
Hello all,
I am working on connecting SQLite up to another programming language,
and had a question about how SQLite (or SQL in general) would handle
this...
I want to be able to create some tables dynamically (same structure,
different name), and I thought this might work...
CREATE TABLE ?1 (x double, y double);
And then I would assign '?1' to a string...
BUT, it would appear that SQLite does not like this, because when I
try to 'prepare' the SQL, it complains about "error near '?1': syntax
error"...
Is there something that I can do, short of generating the SQL
dynamically (ie allow the use of placeholders for the table name)?
Thanks,
Mike
--
Peace may sound simple—one beautiful word— but it requires everything
we have, every quality, every strength, every dream, every high ideal.
—Yehudi Menuhin (1916–1999), musician
_______________________________________________
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