Bug #75201 [Opn->Nab]: 0-column rowsets not identified

From: Date: Thu, 05 Oct 2017 20:31:55 +0000
Subject: Bug #75201 [Opn->Nab]: 0-column rowsets not identified
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211537@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 Updated by: adambaratz@php.net Reported by: fandrieu at gmail dot com Summary: 0-column rowsets not identified -Status: Open +Status: Not a bug Type: Bug Package: PDO DBlib Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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! Previous Comments: ------------------------------------------------------------------------ [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 (#211537) next »