pdo_mysql and bug_39858.phpt

From: Date: Sun, 25 Aug 2013 05:52:21 +0000
Subject: pdo_mysql and bug_39858.phpt
Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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


Thread (1 message)

  • Stas Malyshev
« previous php.internals (#68622) next »