Skip to Content.
Sympa Menu

freetds - RE: [freetds] stored proc parameters

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] stored proc parameters
  • Date: Fri, 3 Dec 2004 13:43:07 +0100

>
> Josh,
>
> Your technique of passing a NULL pointer as the value
> parameter, to indicate a NULL paremeter is not documented for
> dbrpcparam in either Sybase or SQL Server. That doesn't mean
> it doesn't work, though.
>
> The accepted method of passing a NULL parameter is to set
> datalen to 0 .
>
> The question is: should we implement the undocumented
> technique of passing a NULL parameter or not ?
>
> Bill
>

It's documented.
From
http://sybooks.sybase.com/onlinebooks/group-cn/cng1251e/dblib/@Generic__
BookTextView/31893;pt=31893#X

datalen

The length, in bytes, of the RPC parameter to pass to the stored
procedure. This length should not count any null terminator.

If type is SYBCHAR, SYBVARCHAR, SYBBINARY, SYBVARBINARY, SYBBOUNDARY, or
SYBSENSITIVITY, datalen must be specified. Passing datalen as -1 for any
of these datatypes results in the DBPROCESS referenced by dbproc being
marked as "dead," or unusable.

If type is a fixed length datatype, for example, SYBINT2, pass datalen
as -1.

If the value of the RPC parameter is NULL, pass datalen as 0, even if
type is a fixed-length datatype.


This also means that you CANNOT pass a empty string ("") as an input RPC
parameter (like in TDS 4.2).
Also note that in libTDS column_cur_size == 0 do not means NULL (to
support empty string).
A question raise: it's possible that in param_info_alloc calling
param_row_alloc column_cur_size <= 0 so to cause a core ??


freddy77




Archive powered by MHonArc 2.6.24.

Top of Page