Hi!
I'm looking into tests fails that I get with mysqlnd and mysql enabled,
and on bug_39858.phpt I've noticed a strange thing. The code goes like this:
$stmt = $db->prepare("CALL p()");
$stmt->execute();
do {
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
} while ($stmt->nextRowset());
And the test tests it in emulation mode and native mode. However these
modes work differently. If you look at mysq_statement.c, specifically
into pdo_mysql_stmt_next_rowset, then after "if (!H->emulate_prepare)"
the code discards last rowset, with the comment:
MySQL gives us n + 1 result sets for
CALL proc() and n result sets returned by the proc itself.
Result set n + 1 is about the procedure call itself.
As the PDO emulation does not return it, we skip it as well
However, the code after that does not discard last rowset (line 414 and
below), instead it returns true and then fetchAll fails on this one with:
Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error
This happens only if it is compiled with mysqlnd and only after
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 1);
Any ideas what's going on and why the emulation code does not discard
the last rowset?
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227