At 16:41 +0100 8/5/02, Ewen Marshall wrote:
> I am executing the following code in a cgi script which
>should create a table:
>my($dbh) = DBI->connect('DBI:mysql:s_d','root','mypass') or die
>"Canny Connect to s_d DB: $DBI::errstr\n";
>$sql = "create table $unique_id (id VARCHAR(15), id_desc TINYTEXT);
>INSERT INTO $unique_id VALUES (\'z\',\'Other....\'); INSERT INTO
>$sth = $dbh->prepare($sql);
The DBI driver for MySQL is based on the C client library. The API
implemented by that API does not support sending multiple statements
within a single query string. You have to issue the statements separately.
Also, you don't include the semicolon at the end of the statements.
>however, no table is created. When I print off the code in the browser:
>create table vmi (id VARCHAR(15), id_desc TINYTEXT); INSERT INTO vmi
>VALUES ('z','Other....'); INSERT INTO vmi VALUES ('1','Cannot Start
>and execute the query in Mysql-front it works fine.
I would assume that MySQLFront, like the mysql program, preparses
the query string to find semicolons, breaks the string into separate
queries, and issues them separately.