Bug #75201 [Com]: 0-column rowsets not identified

From: Date: Tue, 10 Oct 2017 08:29:31 +0000
Subject: Bug #75201 [Com]: 0-column rowsets not identified
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211596@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75201&edit=1 ID: 75201 Comment by: fandrieu at gmail dot com Reported by: fandrieu at gmail dot com Summary: 0-column rowsets not identified Status: Not a bug Type: Bug Package: PDO DBlib Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This particular issue has just been fixed upstream: https://github.com/FreeTDS/freetds/commit/965a3a9a67373e3159c86ec26cc17a5e72b4eb0f Bug #69592 is still present but now we get the expected result here. Previous Comments: ------------------------------------------------------------------------ [2017-10-06 09:17:07] fandrieu at gmail dot com Thanks for taking the time to investigate this. Actually the underlying issue to #69592 has just been reported to FreeTDS github: https://github.com/FreeTDS/freetds/issues/156 ------------------------------------------------------------------------ [2017-10-05 20:31:52] adambaratz@php.net I was able to reproduce this issue. But stepping through the example in gdb, I didn't see pdo_dblib doing anything wrong. When it calls dbnumcols() in pdo_dblib_stmt_next_rowset_no_cancel(), it simply gets the unexpected value back. I don't think this is a strange MSSQL nuance. My guess is that it's an issue with FreeTDS. I'd suggest filing an issue with that team: https://github.com/FreeTDS/freetds/issues If you don't get feedback, try reaching out on their mail list: https://lists.ibiblio.org/mailman/listinfo/freetds Hope this helps! ------------------------------------------------------------------------ [2017-09-13 08:22:07] fandrieu at gmail dot com Description: ------------ This is a follow up to the bug #69592 about skipping 0-column rowsets I've been using the suggested "if ($statement->columnCount())" workaround to avoid this problem, but it doesn't work after a non empty rowset: columnCount is not set correctly and reports the column count of the previous rowset. Test script: --------------- $pdo = new PDO("dblib:host=<host>;dbname=<dbname>", "username", "password"); $stmt = $pdo->query(" SET NOCOUNT ON SELECT 1 SET NOCOUNT ON SELECT 1 "); do { echo "columns: " . $stmt->columnCount() . "\n"; print_r($stmt->fetchAll(PDO::FETCH_ASSOC)); } while ($stmt->nextRowset()); Expected result: ---------------- [with bug #69592] columns: 0 Array ( ) columns: 1 Array ( [0] => Array ( [computed] => 1 ) ) columns: 0 Array ( ) columns: 1 Array ( [0] => Array ( [computed] => 1 ) ) Actual result: -------------- columns: 0 Array ( ) columns: 1 Array ( [0] => Array ( [computed] => 1 ) ) columns: 1 Array ( ) columns: 1 Array ( [0] => Array ( [computed] => 1 ) ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75201&edit=1

« previous php.bugs (#211596) next »