#36961 [NEW]: mssql_bind will not bind an image field

From: Date: Mon, 03 Apr 2006 22:23:41 +0000
Subject: #36961 [NEW]: mssql_bind will not bind an image field
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95289@lists.php.net to get a copy of this message
From:             nerovichr at hotpop dot com
Operating system: Win2k
PHP version:      5.1.2
PHP Bug Type:     MSSQL related
Bug description:  mssql_bind will not bind an image field

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 bug report at http://bugs.php.net/?id=36961&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36961&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36961&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36961&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36961&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=36961&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36961&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36961&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36961&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36961&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36961&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=36961&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=36961&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36961&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36961&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36961&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36961&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36961&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36961&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36961&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36961&r=mysqlcfg


Thread (11 messages)

« previous php.bugs (#95289) next »