【发布时间】:2013-10-23 14:13:01
【问题描述】:
我阅读了其他答案,大多数都通过添加 $sth->closeCursor(); 解决了。 我对 sprocs 进行了多次调用,但每个调用仍然出现错误。
这是我的代码:
<?php
$sql = "CALL get_salesquote_lineitems(:salesquoteguid);";
$array = array('salesquoteguid' => $salesquoteguid);
$sth = $dbh->prepare($sql);
if ($sth->execute($array)) {
$lineItems = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth->closeCursor();
}
$sql = "CALL get_salesquote_totals(:salesquoteguid);";
$array = array('salesquoteguid' => $salesquoteguid);
$sth = $dbh->prepare($sql);
if ($sth->execute($array)) {
$totalData = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth->closeCursor();
}
$sql = "CALL get_salesquote_data(:salesquoteguid);";
$array = array('salesquoteguid' => $salesquoteguid);
$sth = $dbh->prepare($sql);
if ($sth->execute($array)) {
$quoteData = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth->closeCursor();
}
$sql = "CALL get_salesquote_warranty_rows(:salesquoteguid);";
$array = array('salesquoteguid' => $salesquoteguid);
$sth = $dbh->prepare($sql);
if ($sth->execute($array)) {
$warrantyRows = $sth->fetchAll(PDO::FETCH_ASSOC);
$sth->closeCursor();
}
我也试过了:
$cn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
请问有什么进一步的帮助吗? 谢谢
【问题讨论】:
-
我想你想知道我花了一些时间在我的测试服务器上设置它并且无法复制你的问题。这使我怀疑您的存储过程存在问题,或者您返回的数据量存在问题。
-
非常感谢。有人在办公室为我整理过 :)