Bug #69592 [NEW]: PDO_DBLIB MSSQL ignore SET NOCOUNT ON
From: martinpop83 at gmail dot com
Operating system: Linux
PHP version: Irrelevant
Package: PDO DBlib
Bug Type: Bug
Bug description:PDO_DBLIB MSSQL ignore SET NOCOUNT ON
Description:
------------
MS SQL usually return results for every query. For INSERT/UPDATE/DELETE
return empty results and number of affected rows. It can be turn off by
SET NOCOUNT ON and results will be returned only after SELECT queries.
pdo_dblib ignore SET NOCOUNT ON and still creating empty result sets
(rowsets).
With pdo_sqlsrv (Windows server) and mssql (Linux server, FreeTDS) is
everything ok.
Test script:
---------------
$pdo = new PDO("dblib:host=<host>;dbname=<dbname>", "username",
"password");
$stmt = $pdo->query("
SET NOCOUNT ON
DECLARE @tempTable TABLE(value VARCHAR(20), find BIT)
INSERT INTO @tempTable(value, find) VALUES('textA', 1)
INSERT INTO @tempTable(value, find) VALUES('textB', 0)
SELECT * FROM @tempTable
");
do
{
print_r($stmt->fetchAll(PDO::FETCH_ASSOC));
}
while ($stmt->nextRowset());
Expected result:
----------------
Array
(
[0] => Array
(
[value] => textA
[find] => 1
)
[1] => Array
(
[value] => textB
[find] => 0
)
)
Actual result:
--------------
Array
(
)
Array
(
[0] => Array
(
[value] => textA
[find] => 1
)
[1] => Array
(
[value] => textB
[find] => 0
)
)
--
Edit bug report at https://bugs.php.net/bug.php?id=69592&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69592&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69592&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69592&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69592&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69592&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69592&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69592&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69592&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69592&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69592&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69592&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69592&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69592&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69592&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69592&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69592&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69592&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69592&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69592&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69592&r=mysqlcfg
Thread (5 messages)
- martinpop83 at gmail dot com