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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC