php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72969 SET ROWCOUNT returns no result
Submitted: 2016-08-29 20:14 UTC Modified: 2017-01-27 23:49 UTC
From: plebrun at wayfair dot com Assigned: adambaratz (profile)
Status: Closed Package: PDO DBlib
PHP Version: 7.0Git-2016-08-29 (Git) OS: CentOS7
Private report: No CVE-ID: None
 [2016-08-29 20:14 UTC] plebrun at wayfair dot com
Description:
------------
Using SET ROWCOUNT does not return a result set (which could be expected), but it also affects the rowcounts of other queries.  The same with SET NOCOUNT ON.  I would expect one of the following behaviors:

1. Return empty resultset with columnCount() = 0 and rowCount() = -1; call to nextRowset() returns true
2. Does not return any resultset BUT ALSO doesn't affect other queries.

See example below.

Test script:
---------------
<?php                                                                                    
$db = new \PDO("dblib:host=server;dbname=database", "username", "password");
$stmt = $db->query("SET ROWCOUNT 10; INSERT INTO tbl VALUES (1, 'a'), (2, 'b');");
var_dump($stmt->rowCount());
var_dump($stmt->nextRowset());
var_dump($stmt->rowCount());
?>

Expected result:
----------------
int(-1)
bool(true)
int(2)

Actual result:
--------------
int(-1)
bool(false)
int(-1)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-27 23:49 UTC] adambaratz@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: adambaratz
 [2017-01-27 23:49 UTC] adambaratz@php.net
This was not an issue with pdo_dblib, but rather with FreeTDS. FreeTDS has been fixed as of the fc820490336c50d5c175d2a15327383256add4c9 on that repo. Corresponding tests were pushed to our master branch (f45e6364b46d40a747d183ee11cbaa5c8743a141).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC