Bug #60122 [Opn]: Many multi-row statements gives wrong result
| From: | ssufficool@php.net | Date: | Sun, 04 Dec 2011 17:59:00 +0000 |
| Subject: | Bug #60122 [Opn]: Many multi-row statements gives wrong result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-165657@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60122&edit=1
ID: 60122
Updated by: ssufficool@php.net
Reported by: armiksos at gmail dot com
Summary: Many multi-row statements gives wrong result
Status: Open
Type: Bug
Package: PDO related
Operating System: windows 7
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
Which driver are you using (i.e. MySQL, PostgreSQL, DBLIB, SqlServer?)
Previous Comments:
------------------------------------------------------------------------
[2011-10-24 14:49:39] armiksos at gmail dot com
Description:
------------
If you create two query of multi-row statements in one .php file and you assign
them
to the same variable after processing one of them, the second query will give only
result of only ONE statement.
If you assign the result of query to another variable, the result will be correct.
So $another_var_name = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3
as three;");
will work in Test script, otherwise result will be wrong.
Test script:
---------------
$q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3 as
three;");
do
{
$r=$q->fetchAll(PDO::FETCH_ASSOC);
echo "<br />";
print_r($r);
}while($q->nextRowset());
$q = $conn->query("SELECT 1 as one; SELECT 2 as two; SELECT 3 as
three;");
do
{
$r=$q->fetchAll(PDO::FETCH_ASSOC);
echo "<br />";
print_r($r);
}while($q->nextRowset());
Expected result:
----------------
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) )
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) )
Actual result:
--------------
Array ( [0] => Array ( [one] => 1 ) )
Array ( [0] => Array ( [two] => 2 ) )
Array ( [0] => Array ( [three] => 3 ) )
Array ( [0] => Array ( [one] => 1 ) )
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60122&edit=1