Menu

#87 Choosing datalength when binding fixed types

closed-fixed
nobody
db-lib (28)
5
2003-05-03
2003-05-03
No

When binding parameters of fixed-length types in dblib,
the parameter "datalen" passed to dbrpcparam should be
(almost) ignored.

Current FreeTDS behaviour is to use the datalen
parameter to determine how many bytes to copy from the
parameter into the rpc message. Sybase and mssql
documentation state that for fixed types, datalen
should be set to -1, and when freetds passes -1 to
memcpy, the application segfaults.

This patch changes param_info_alloc, which is called
from dprpcparam, to check if we are dealing with a
fixed-size type, and if so, then it uses
tds_get_size_by_type to set the relevant member in
TDSCOLINFO and pass to memcpy.

In the case of variable-sized types, the original
behaviour is pertained.

This should fix my earlier reported bug no. 731810, but
I don't know if it breaks anything else.

Discussion

  • Arnar Birgisson

    Arnar Birgisson - 2003-05-03

    Patch to fix dbrpcparams interpretation of datalen

     
  • Frediano Ziglio

    Frediano Ziglio - 2003-05-03
    • status: open --> closed-fixed
     

Log in to post a comment.