[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-internals
Subject:    [PHP-DEV] pdo_mysql and bug_39858.phpt
From:       Stas Malyshev <smalyshev () sugarcrm ! com>
Date:       2013-08-25 5:52:21
Message-ID: 52199B95.1060100 () sugarcrm ! com
[Download RAW message or body]

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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic