[freetds] SP input parameter problem on 0.63

Allan Kim akim at freedom.com
Thu Aug 4 17:01:40 EDT 2005


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()
12:31:57.412749 parm_info_alloc(): parameter null-ness = 0
12:31:57.412810 param_row_alloc, size = 4, offset = 4, row_size = 8
12:31:57.412853 param_row_alloc(): doing data from value
12:31:57.412892 param_row_alloc(): copying 4 bytes of data to parameter #0
12:31:57.413119 parm_info_alloc(): parameter null-ness = 0
12:31:57.413186 param_row_alloc, size = 4, offset = 8, row_size = 12
12:31:57.413229 param_row_alloc(): doing data from value
12:31:57.413267 param_row_alloc(): copying 4 bytes of data to parameter #1
12:31:57.413317 parm_info_alloc(): parameter null-ness = 0
12:31:57.413366 param_row_alloc, size = 4, offset = 12, row_size = 16
12:31:57.413408 param_row_alloc(): doing data from value
12:31:57.413446 param_row_alloc(): copying 4 bytes of data to parameter #2
12:31:57.413496 parm_info_alloc(): parameter null-ness = 1
12:31:57.413553 param_row_alloc, size = 0, offset = 16, row_size = 4016
12:31:57.413601 param_row_alloc(): doing data from value
12:31:57.413639 param_row_alloc(): setting parameter #3 to NULL
12:31:57.413679 setting column 3 NULL bit
12:31:57.413723 tds_free_all_results()
12:31:57.413782 tds_put_data_info putting param_name
12:31:57.413832 tds_put_data_info putting status
12:31:57.413874 tds_put_data: is_null = 0, colsize = 4
12:31:57.413915 tds_put_data: not null param varint_size = 0
12:31:57.413957 swapping coltype 56
12:31:57.413999 tds_put_data_info putting param_name
12:31:57.414045 tds_put_data_info putting status
12:31:57.414085 tds_put_data: is_null = 0, colsize = 4
12:31:57.414125 tds_put_data: not null param varint_size = 0
12:31:57.414165 swapping coltype 56
12:31:57.414205 tds_put_data_info putting param_name
12:31:57.414250 tds_put_data_info putting status
12:31:57.414290 tds_put_data: is_null = 0, colsize = 4
12:31:57.414330 tds_put_data: not null param varint_size = 0
12:31:57.414370 swapping coltype 56
12:31:57.414410 tds_put_data_info putting param_name
12:31:57.414455 tds_put_data_info putting status
12:31:57.414496 tds_put_data: is_null = 1, colsize = 0
12:31:57.414536 tds_put_data: null param
12:31:57.414576 Sending packet
0000 03 01 00 7d 00 00 01 00-0b 00 73 00 70 00 5f 00 |...}.... ..s.p._.|
0010 54 00 65 00 61 00 6d 00-5f 00 57 00 4c 00 54 00 |T.e.a.m. _.W.L.T.|
0020 00 00 0c 40 00 54 00 65-00 61 00 6d 00 41 00 6c |... at .T.e .a.m.A.l|
0030 00 6c 00 6f 00 63 00 49-00 64 00 00 38 ff ff ff |.l.o.c.I .d..8...|
0040 ff 09 40 00 4c 00 65 00-61 00 67 00 75 00 65 00 |.. at .L.e. a.g.u.e.|
0050 49 00 64 00 00 38 10 00-00 00 05 40 00 42 00 55 |I.d..8.. ... at .B.U|
0060 00 69 00 64 00 00 38 01-00 00 00 03 40 00 52 00 |.i.d..8. .... at .R.|
0070 53 00 01 a7 a0 0f 09 04-d0 00 34 ff ff          |S....... ..4..|


12:31:57.415184 in dbsqlok()
12:31:57.415603 Received header
0000 04 01 00 ff 00 4b 01 00-                        |.....K..|

12:31:57.415743 Received packet
0000 aa d2 00 c9 00 00 00 03-10 4e 00 50 00 72 00 6f |........ .N.P.r.o|
0010 00 63 00 65 00 64 00 75-00 72 00 65 00 20 00 27 |.c.e.d.u .r.e. .'|
0020 00 73 00 70 00 5f 00 54-00 65 00 61 00 6d 00 5f |.s.p._.T .e.a.m._|
0030 00 57 00 4c 00 54 00 27-00 20 00 65 00 78 00 70 |.W.L.T.' . .e.x.p|
0040 00 65 00 63 00 74 00 73-00 20 00 70 00 61 00 72 |.e.c.t.s . .p.a.r|
0050 00 61 00 6d 00 65 00 74-00 65 00 72 00 20 00 27 |.a.m.e.t .e.r. .'|
0060 00 40 00 53 00 65 00 61-00 73 00 6f 00 6e 00 49 |. at .S.e.a .s.o.n.I|
0070 00 44 00 27 00 2c 00 20-00 77 00 68 00 69 00 63 |.D.'.,.  .w.h.i.c|
0080 00 68 00 20 00 77 00 61-00 73 00 20 00 6e 00 6f |.h. .w.a .s. .n.o|
0090 00 74 00 20 00 73 00 75-00 70 00 70 00 6c 00 69 |.t. .s.u .p.p.l.i|
00a0 00 65 00 64 00 2e 00 0a-56 00 41 00 52 00 53 00 |.e.d.... V.A.R.S.|
00b0 49 00 54 00 59 00 53 00-51 00 4c 00 0b 73 00 70 |I.T.Y.S. Q.L..s.p|
00c0 00 5f 00 54 00 65 00 61-00 6d 00 5f 00 57 00 4c |._.T.e.a .m._.W.L|
00d0 00 54 00 00 00 ac 16 00-03 40 00 52 00 53 00 01 |.T...... . at .R.S..|
00e0 a7 00 00 00 a7 a0 0f 09-04 d0 00 34 ff ff fe 02 |........ ...4....|
00f0 00 e0 00 00 00 00 00   -                        |.......|








-- 
------------------------------
Allan Kim
Freedom Communications
Business Application Development
E-mail: akim at freedom.com
Phone: (949) 798-3568
------------------------------



More information about the FreeTDS mailing list