List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:August 7 2002 12:54am
Subject:Re: Problems Creating Tables With Perl/CGI
View as plain text  
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 
>$unique_id VALUES
>$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.
>Any ideas???

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.

>	Ewen
Problems Creating Tables With Perl/CGIEwen Marshall5 Aug
  • Re: Problems Creating Tables With Perl/CGIEwen Marshall6 Aug
  • Re: Problems Creating Tables With Perl/CGIPetr Vileta7 Aug
  • Re: Problems Creating Tables With Perl/CGIPaul DuBois7 Aug