php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55083 working with varbinary on mssql
Submitted: 2011-06-30 04:24 UTC Modified: 2011-07-04 06:38 UTC
From: aznboy84 at gmail dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.3.6 OS: Windows XP x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: aznboy84 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-06-30 04:24 UTC] aznboy84 at gmail dot com
Description:
------------
I have a MSSQL table with a varbinary(5600) field and i found no way to get it with PDO, got "Invalid sql_display_size" on $stmt->fetch()

<?php

date_default_timezone_set("Asia/Saigon");
require "connect.php";

$stmt = $MSSQL->prepare("SELECT SCFS5Quest FROM SCFS5Quest WHERE Name = 'hack'");

$stmt->execute(array('hack'));
$stmt->bindColumn(1, $lob, PDO::PARAM_LOB,1,PDO::SQLSRV_ENCODING_BINARY);
$stmt->fetch(PDO::FETCH_BOUND);

//print_r($scf);
echo bin2hex($scf);


?>

Test script:
---------------
<?php

date_default_timezone_set("Asia/Saigon");
require "connect.php";

$stmt = $MSSQL->prepare("SELECT SCFS5Quest FROM SCFS5Quest WHERE Name = 'hack'");

$stmt->execute(array('hack'));
$stmt->bindColumn(1, $lob, PDO::PARAM_LOB,1,PDO::SQLSRV_ENCODING_BINARY);
$stmt->fetch(PDO::FETCH_BOUND);

//print_r($scf);
echo bin2hex($scf);


?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 16:29 UTC] frozenfire@php.net
-Status: Open +Status: Bogus
 [2011-07-01 16:29 UTC] frozenfire@php.net
The PDO MSSQL driver is known to be very buggy, and has been replaced by the 
sqlsrv extension. If you must use PDO for MSSQL, you might try using the ODBC 
driver.

In any case, this isn't a documentation issue.
 [2011-07-04 06:38 UTC] RQuadling@php.net
The new MS SQL Server Driver for PHP also comes in a PDO variant.

http://www.php.net/manual/en/intro.mssql.php -> http://msdn.microsoft.com/en-
us/sqlserver/ff657782.aspx
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Sep 23 15:01:24 2023 UTC