4 messages in com.mysql.lists.win32Re: Problems Creating Tables With Per...| From | Sent On | Attachments |
|---|---|---|
| Ewen Marshall | 05 Aug 2002 08:41 | |
| Ewen Marshall | 06 Aug 2002 05:00 | |
| Petr Vileta | 06 Aug 2002 16:44 | |
| Paul DuBois | 06 Aug 2002 17:53 |
| Subject: | Re: Problems Creating Tables With Perl/CGI![]() |
|---|---|
| From: | Paul DuBois (pa...@snake.net) |
| Date: | 08/06/2002 05:53:39 PM |
| List: | com.mysql.lists.win32 |
At 16:41 +0100 8/5/02, Ewen Marshall wrote:
Folks,
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 (\'1\',\'$first_desc\');"; $sth = $dbh->prepare($sql); $sth->execute();
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 VMI Software');
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.
TIA,
Ewen




