php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36961 mssql_bind will not bind an image field
Submitted: 2006-04-03 22:23 UTC Modified: 2016-10-15 23:07 UTC
Votes:9
Avg. Score:4.8 ± 0.6
Reproduced:9 of 9 (100.0%)
Same Version:5 (55.6%)
Same OS:3 (33.3%)
From: rnerovich at gmail dot com Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2CVS-2007-07-11 OS: Win2k
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-04-03 22:23 UTC] rnerovich at gmail dot com
Description:
------------
When inserting an image into MSSQL using SQLVARCHAR, this error is thrown with mssql_bind()...
Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter (not expected)

If SQLTEXT is used the bind succeeds, but the execute fails with...
Operand type clash: text is incompatible with image (expected)

Reproduce code:
---------------
// $filedata read in from drive, $filelen = lenth of data
$sp = mssql_init('MSG_PROC_TEST',$dblink->dbresource);
$mrecnum = '{1C296DF1-EE73-436E-BC55-09C58F53C132}';
$mfilename = '1075318802KUZMA.WAV';
mssql_bind($sp,"@MRECNUM", $mrecnum,SQLVARCHAR,FALSE,FALSE,38);
mssql_bind($sp,"@MFILENAME",$mfilename, SQLVARCHAR,FALSE,FALSE,strlen($mfilename));
mssql_bind($sp,"@MID",&$mid,SQLVARCHAR,true,false,38);
mssql_bind($sp,"@MWAVS",$filedata, SQLVARCHAR,false,false,$filelen);
if(mssql_execute($sp)){
... 

sp example
CREATE PROCEDURE MSG_PROC_TEST
	@MRECNUM UNIQUEIDENTIFIER, @MFILENAME VARCHAR(50),@MID UNIQUEIDENTIFIER OUTPUT,
	@MWAVS IMAGE


Expected result:
----------------
Insert file into image field in MSSQL successfully.

Actual result:
--------------
mssql_bind() or mssql_execute() fails because the data conversion to an image type doesn't work correctly.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-11 17:59 UTC] rnerovich at gmail dot com
Tried the release at http://snaps.php.net/win32/php5.2-win32-latest.zip and got the following calling mssql_bind($sp,"@WAVEIMAGE",$waveinfo,SQLVARCHAR,FALSE,FALSE,$length);
Error:E_WARNING mssql_bind()['a href='function.mssql-bind'>function.mssql-bind</a>]: Unable to set parameter at <xx.php> line xx
 [2007-08-17 10:56 UTC] jani@php.net
Assigned to the maintainer.
 [2008-05-28 16:10 UTC] dmeglio at rightreasontech dot com
Does this issue still exist? I'm still having this issue 2 years after it was reported. 

Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in ... on line 135
 [2008-05-28 16:21 UTC] rnerovich at gmail dot com
I've not gotten any updates in almost a year on the issue.  It's one of the reasons we've had to abandon PHP in our next generation of our products.
 [2008-12-15 22:30 UTC] timbob1000 at gmail dot com
Is anybody working on this?
 [2014-12-29 01:05 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: fmk +Assigned To:
 [2016-10-15 23:07 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:07 UTC] kalle@php.net
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 12:01:23 2020 UTC