Skip to Content.
Sympa Menu

freetds - Re: [freetds] SP input parameter problem on 0.63

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SP input parameter problem on 0.63
  • Date: Sat, 06 Aug 2005 12:47:28 +0200

Il giorno gio, 04/08/2005 alle 14.01 -0700, Allan Kim ha scritto:
> I seem to be having a problem invoking a stored procedure on MSSQL
> Server 2K using FreeTDS 0.63 through ADODB and PHP 5.0.4. From what I
> can glean from the logs it seems ADODB is unable to bind values to
> certain parameters, possibly because FreeTDS doesn't recognize those
> parameters.
>
> I've downgraded to 0.62.4 and everything works again, but at some point
> we would like to upgrade to a newer version. I have more debugging data
> that I can make available as required.
>
> Platform is Solaris 9 using gcc 3.4.2.
>
> Thanks in advance for your assistance!
>
>
> Stored procedure:
>
> CREATE proc sp_Team_WLT
> @TeamAllocId int,
> @LeagueId int,
> @SeasonID int,
> @BUId int,
> @SportId int,
> @TeamGenderCd char(4),
> @RS varchar(8000) OUTPUT
> AS (etc. etc. etc.)
>
>
>
> Matching PHP code:
>
> $st = $db->PrepareSP('sp_Team_WLT');
> $db->InParameter($st, $none,
> 'TeamAllocId');
> $db->InParameter($st, $l->getleagueId(), 'LeagueId');
>
> $db->InParameter($st, $seasonID, 'SeasonID');
> $db->InParameter($st,
> $buid, 'BUid');
> $db->InParameter($st, $sportID, 'SportId');
>
> $db->InParameter($st, $gender, 'TeamGenderCd');
> $db->OutParameter($st,
> $ret,'RS');
>
> $db->Execute($st);
>
>
> Apache error log:
>
> [Thu Aug 4 12:31:57 2005] [error] PHP Warning: mssql_bind() [<a
> href='function.mssql-bind'>function.mssql-bind</a>]: Unable to set
> parameter in /usr/loc
> al/lib/php/adodb460/drivers/adodb-mssql.inc.php on line 613
> [Thu Aug 4 12:31:57 2005] [error] PHP Warning: mssql_bind() [<a
> href='function.mssql-bind'>function.mssql-bind</a>]: Unable to set
> parameter in /usr/loc
> al/lib/php/adodb460/drivers/adodb-mssql.inc.php on line 613
> [Thu Aug 4 12:31:57 2005] [error] PHP Warning: mssql_bind() [<a
> href='function.mssql-bind'>function.mssql-bind</a>]: Unable to set
> parameter in /usr/loc
> al/lib/php/adodb460/drivers/adodb-mssql.inc.php on line 613
>
>
> freetds.log output:
>
> 12:31:57.409736 dbrpcinit() added rpcname "sp_Team_WLT"
> 12:31:57.410286 dbrpcparam() added parameter "@TeamAllocId"
> 12:31:57.410584 dbrpcparam() added parameter "@LeagueId"
> 12:31:57.411407 dbrpcparam() added parameter "@BUid"
> 12:31:57.412445 dbrpcparam() added parameter "@RS"
> 12:31:57.412668 dbrpcsend()

Why are some parameters accepted but not all??

Code that fail in dbrpcparam should be

if (is_fixed_type(type)) {
if (datalen > 0)
return FAIL;
} else {
if (datalen < 0)
return FAIL;
}

/* validate maxlen parameter */

if (status & DBRPCRETURN) {
if (is_fixed_type(type)) {
if (maxlen != -1)
return FAIL;
} else {
if (maxlen == -1)
maxlen = 255;
}
} else {
if (maxlen != -1)
return FAIL;
}

I checked also PHP code and I this problem reside if parameter is input
and null (empty string??) in PHP. This would cause status == 0 and
maxlen == 0 (witch is not accepted). Did I guess?

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page