php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29408 Binding certain types of variables clears all bindings
Submitted: 2004-07-27 15:57 UTC Modified: 2004-07-28 10:57 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: mynameisfiber at gmail dot com Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 4.3.7 OS: linux 2.6.5-gentoo-r1
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: mynameisfiber at gmail dot com
New email:
PHP Version: OS:

 

 [2004-07-27 15:57 UTC] mynameisfiber at gmail dot com
Description:
------------
i am trying to do mssql (through freetds 0.62.3) with stored proc's however if i try sending in a parameter of SQLVARCHAR, SQLCHAR, SQLTEXT, none of the parameters go through... in the following example, i get an error if @loginName is sent as a SQLVARCHAR (and uppon sniffing the actual request i see that NO parameters are sent in this case) however if i change it to SQLINT2 everything works fine (except @loginName goes in as '0' which isn't productive).

the only possible thing i can think of to explain this is that the message is too long and becomes truncated? or maybe this version of PHP hasn't updated it's mssql connection module?  does anyone have any ideas or even any solutions? 

thanks alot! :-)

Reproduce code:
---------------
(after connecting to the database)
        $query = mssql_init('adSetUserByLogin', $dbcnx); 

	$org = 360;
	$user = "a";
	mssql_bind($query, "@orgId", $org, SQLINT2);
	mssql_bind($query, "@loginName", $user, SQLVARCHAR);
			
        $res = mssql_execute($query); 

Expected result:
----------------
i would have expected the stored procedure to go on just fine so that it's output could be later retrieved

Actual result:
--------------
Warning: mssql_execute(): message: Procedure 'adSetUserByLogin' expects parameter '@orgId', which was not supplied. (severity 16) in /var/www/localhost/htdocs/aosr/test.php on line 24

Warning: mssql_execute(): stored procedure execution failed in /var/www/localhost/htdocs/aosr/test.php on line 24

Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-result resource in /var/www/localhost/htdocs/aosr/test.php on line 27

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-27 16:14 UTC] patrick dot schutte at gmx dot de
Hi,

try mssql_bind($query, "@orgId", $org, SQLINT2,FALSE,FALSE);
	mssql_bind($query, "@loginName", $user, SQLVARCHAR,FALSE,FALSE,n);

n=len of varchar in stroed Procedure

Works fine with PHP5/freetds0.62.3/MSSQL2000/tdsversion=7.0
 [2004-07-28 10:57 UTC] mynameisfiber at gmail dot com
thanks alot! that fixed everything right up proving it wasn't infact a bug.  i'm putting a note in the mssql_bind page to clear this up for others.  thanks again :-)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Oct 05 18:01:28 2024 UTC