ID: 36961 Comment by: rnerovich at gmail dot com Reported By: nerovichr at hotpop dot com Status: Open Bug Type: MSSQL related Operating System: Win2k PHP Version: 5.1.2 New Comment:
When you get around to this, my email has changed. Previous Comments: ------------------------------------------------------------------------ [2006-04-03 22:23:41] nerovichr at hotpop 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36961&edit=1