PDO调用存储过程的问题

我已经设置了
$GDBObj->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);

连续调用两次
$pdo->query("select xxxxx");
$pdo->query("select yyyyyy");
没有问题

但是如果调用存储过程
$pdo->query("call xxxx");
$pdo->query("select yyyyy");
就会报错:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.'

作者: updd   发布时间: 2008-04-15

错误信息说的很明白了啊 存储过程不能缓存结果 要用fetchAll来一次性获得结果

作者: ten789   发布时间: 2008-04-15

我fetchAll了,还是一样的
$Stmt = $pdo->query("call xxxx()");
$Info = $Stmt->fetchAll();
......
$Stmt2 = $pdo->query("select yyyyy");
$Stmt2->fetchAll();

还是报同样的错

作者: updd   发布时间: 2008-04-15

$Stmt = $pdo->fetchall('callxxx();');

PDO可以这样么 没用过一直在用ZEND_DB

作者: ten789   发布时间: 2008-04-15

不好意思 看了下手册pdo->fetchall 不能这样用

作者: ten789   发布时间: 2008-04-15

PDO::MYSQL_ATTR_USE_BUFFERED_QUERY 

$Stmt2 = $pdo->query("select yyyyy", array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));试试吧 也许有用

作者: ten789   发布时间: 2008-04-15

也试过了。。。。没用

作者: updd   发布时间: 2008-04-15

没遇到过这种情况.

作者: meiZiNick   发布时间: 2008-05-01

lz要干嘛?

作者: UltraBejing   发布时间: 2008-05-01

It is worth noting that not all attributes may be settable via setAttribute(). For example, PDO::MYSQL_ATTR_MAX_BUFFER_SIZE is only settable in PDO::__construct(). You must pass PDO::MYSQL_ATTR_MAX_BUFFER_SIZE as part of the optional 4th parameter to the constructor. This is detailed in http://bugs.php.net/bug.php?id=38015

作者: Lepingbeta   发布时间: 2011-01-27