php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69591 PDO_DBLIB MSSQL more statements error
Submitted: 2015-05-07 08:39 UTC Modified: 2016-09-12 22:16 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: martinpop83 at gmail dot com Assigned:
Status: Not a bug Package: PDO DBlib
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2015-05-07 08:39 UTC] martinpop83 at gmail dot com
Description:
------------
I can't create two and more select statements with pdo_dblib. If I try it, pdo_dblib create weird combination of statements into first statement and others returns false.

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");

$stmtA = $pdo->query("SELECT 1 AS number, 'aaa' AS text");
$stmtB = $pdo->query("SELECT 'val' AS value");

print_r($stmtA->fetch(PDO::FETCH_ASSOC));
print_r($stmtB->fetch(PDO::FETCH_ASSOC));


Expected result:
----------------
Array
(
    [number] => 1
    [text] => aaa
)

Array
(
    [value] => val
)


Actual result:
--------------
Array
(
    [value] => val
    [text] => 
)

bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-02 17:32 UTC] christophe at delmas dot ch
Hello

I have exactly same problem on ubuntu 14.04 LTS

Linux ubuntu 3.16.0-41-generic #57~14.04.1-Ubuntu SMP Thu Jun 18 18:01:13 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

packages :
freetds 0.91-5
php5 5.5.9+dfsg-1ubuntu4.9

Regards
 [2015-07-02 18:02 UTC] christophe at delmas dot ch
Hi

I think this is related to https://bugs.php.net/bug.php?id=65945

Regards
 [2015-07-07 17:49 UTC] martinpop83 at gmail dot com
Yes, https://bugs.php.net/bug.php?id=65945 explain this problem.

But this DBLIB behavior is very annoying, because other drivers have support for more statements on the same connection. In this case DBLIB is unusable for general database wrappers.
 [2016-02-11 14:28 UTC] miracle at rpz dot name
http://www.freetds.org/mars.html
 [2016-09-12 22:16 UTC] adambaratz@php.net
-Status: Open +Status: Not a bug
 [2016-09-12 22:16 UTC] adambaratz@php.net
See comments on #65945.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed May 22 18:01:28 2019 UTC