[freetds] problem with return values

Cadman, Andrew (Contractor) Andrew_Cadman at eu.odedodea.edu
Tue Jan 13 19:43:06 EST 2004


Hi 

I have a strange problem with OUTPUT parameters using FreeTDS 0.62 with PHP
4.3.2, running Redhat 9, connected to SQL Server 2000.

I can return result sets without any issue at all, but in some cases where a
return value is set -1, it is returned as 0. This happens on a number of
different stored procedures.

However, running the stored procedure directly through SQL SERVER Enterprise
Manager's Query Analuzer utility works just fine and returns the correct
value. A sample of the PHP code is shown below:

$db = new sql_db($dbHost, $dbUser, $dbPasswd, $dbName, false);

$query = $db->sql_sproc_init("dbo.proc_login_registrar");

$param_len_1 = strlen($username);
$param_len_2 = strlen($password);

$db->sql_sproc_bind("@puserid",$username,SQLCHAR,false,false,$param_len_1);
$db->sql_sproc_bind("@ppassword",$password,SQLCHAR,false,false,$param_len_2)
;
$db->sql_sproc_bind("@pRetVal",&$pRetVal,SQLINT2,true,false,1);
$db->sql_sproc_bind("RETVAL",&$pRetValAgain,SQLINT2,true,false,2);

$rw = $db->sql_sproc_exec();


Anyone have any ideas?

thanks in advance,

Andrew Cadman







More information about the FreeTDS mailing list