2008年11月27日星期四

[fw-db] Multiple SQL queries

Is it possible to run multiple SQL queries either at the same time or one
after another?

Let's say I want to make the following:
DECLARE @bob INT;
SET @bob = 42;
SELECT @bob AS bob;

So I go for:
$sql = "DECLARE @bob INT;SET @bob = 42; SELECT @bob AS bob;";
var_dump($db->fetch*($sql));
None of the fecth*()-methods gives me a result of 42.

If I try with:
$sql1 = "DECLARE @bob INT;";
$sql2 = "SET @bob = 42;";
$sql3 = "SELECT @bob AS bob;";
$db->query($sql1);
$db->query($sql2);
$db->query($sql3);

The I get an error at the second query() telling me that @bob is unknown.
--
View this message in context: http://www.nabble.com/Multiple-SQL-queries-tp20717372p20717372.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: