in reply to Multiple SQL statements

I sent the following to MySQL through the DBI and got an error:
$sth = $dbh->prepare("describe node; describe user"); # result DBD::mysql::st execute failed: You have an error in your SQL syntax near '; describe user' at line 1
Looks like you need to return multiple statements, or rewrite your queries to use a self join. (That may work for your purposes, and it may not.)

Replies are listed 'Best First'.
Re: Re: Multiple SQL statements
by voyager (Friar) on Jul 19, 2001 at 18:47 UTC
    (Too lazy to try this out) It is possible that the prepare failed because it is trying to prepare a single SQL statement, but that a $dbh->do("sql 1; sql2") might work.

    This would probably work on the example given (create FOO; create BAR;), but not on the problem to be solved (lack of sub-select), since do isn't going to help on selects.