Skip to Content.
Sympa Menu

freetds - [freetds] SP input parameter problem on 0.63

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Allan Kim <akim AT freedom.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] SP input parameter problem on 0.63
  • Date: Mon, 08 Aug 2005 18:28:09 -0700

First of all, thanks so much everyone for your help so far.

I applied Frediano Zigliano's patch to rpc.c in 0.63 and added some crude debugging code of my own ... I'm still running into problems at that one particular spot (maxlen fails validation) but I'm also running into unexpected results that involve ADODB.

Just for review, here's the SP I'm working with:

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.)

Now by my understanding maxlen should have a value of -1 for non-OUTPUT parameters. But for some reason ADODB calls mssql_bind with maxlen = 4000 by default for all parameters (at least in 4.60 and 4.65 it does). Sometimes it doesn't seem to matter, but sometimes it does matter as you can see below:

17:24:29.003317 dbrpcinit() added rpcname "sp_Team_WLT"
17:24:29.003649 Trying to bind parameter "@TeamAllocId"
17:24:29.003726 dbrpcparam() added parameter "@TeamAllocId"
17:24:29.003953 Trying to bind parameter "@LeagueId"
17:24:29.004017 dbrpcparam() added parameter "@LeagueId"
17:24:29.004217 Trying to bind parameter "@SeasonID"
17:24:29.004273 Died at 191 Trying to bind parameter with maxlen 4000
17:24:29.004822 Trying to bind parameter "@BUid"
17:24:29.004903 dbrpcparam() added parameter "@BUid"
17:24:29.005112 Trying to bind parameter "@SportId"
17:24:29.005169 Died at 191 Trying to bind parameter with maxlen 4000
17:24:29.005579 Trying to bind parameter "@TeamGenderCd"
17:24:29.005680 Died at 191 Trying to bind parameter with maxlen 4000
17:24:29.006220 Trying to bind parameter "@RS"
17:24:29.006304 dbrpcparam() added parameter "@RS"
17:24:29.006507 dbrpcsend()

Note that line 191 reported above corresponds to this line of the patched version of rpc.c.

+ if (maxlen != -1 && maxlen != 0)

As you can see all parameters bind successfully except for @SeasonID, @SportId and @TeamGenderCd. One thing in common with those three parameters: data type. The developer is passing string arguments to the PHP ADODB InParameter() method.

Any insight would be greatly appreciated. Thanks!





Archive powered by MHonArc 2.6.24.

Top of Page