History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-2101
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Simon Mundy
Reporter: Darby Felton
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Can't execute multiple stored procedures with Pdo_Mysql

Created: 26/Oct/07 08:22 AM   Updated: 02/Sep/08 10:38 AM
Component/s: Zend_Db
Affects Version/s: 1.0.2
Fix Version/s: 1.6.0

Time Tracking:
Original Estimate: 1 week
Original Estimate - 1 week
Remaining Estimate: 1 week
Remaining Estimate - 1 week
Time Spent: Not Specified
Remaining Estimate - 1 week

Issue Links:
Dependency
 
Related
 

 Public Fields   Internal Project Management Fields   
Resolution Date: 26/May/08 11:24 PM
Fix Version Priority: Should Have


 Description  « Hide
Patrick Calkins writes:

Code:

$pdoParams = array(
    PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
);

$params = array(
    'host'           => '127.0.0.1',
    'username'       => 'webuser',
    'password'       => 'xxxxxx',
    'dbname'         => 'test',
    'driver_options' => $pdoParams
);

$db = Zend_Db::factory('Pdo_Mysql', $params);

// Stored procedure returns a single row
$stmt = $db->prepare('CALL get_customer_by_id(:customerId)');
$stmt->bindParam('customerId', $customerId, PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll();
print_r($result);

$stmt->closeCursor();

// Stored procedure returns a single row
$stmt = $db->prepare('CALL get_address_by_id(:customerId)');
$stmt->bindParam('customerId', $customerId, PDO::PARAM_INT);
$stmt->execute();
$result = $stmt->fetchAll();
print_r($result);

This will consistently throw this error: '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.'

If you insert $stmt->nextRowset(); before $stmt->closeCursor(); it will
throw this error: 'SQLSTATE[HYC00]: Optional feature not implemented'

This appears to be a bug, and I haven't found any more info as to its status
lately. Is this correct??



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Darby Felton - 26/Oct/07 08:23 AM
Good unit tests that execute multiple stored procedures would hopefully expose the problem.

Wil Sinclair - 21/Mar/08 05:05 PM
This issue should have been fixed for the 1.5 release.

Wil Sinclair - 25/Mar/08 08:43 PM
Please categorize/fix as needed.

Wil Sinclair - 18/Apr/08 01:11 PM
This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Simon Mundy - 26/May/08 11:24 PM
Resolved in r9539

Ralph Schindler - 17/Jun/08 08:36 AM
I think perhaps this issue needs to be merged into the 1.5 branch. Can someone from the community check to see that this works as they expect in their application (the fix is in trunk)?

-Ralph


Wil Sinclair - 02/Sep/08 10:38 AM
Updating for the 1.6.0 release.