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: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] stored proc parameters
  • Date: Fri, 3 Dec 2004 13:23:28 -0000

Freddy,

when you say it IS documented, I take it you mean this piece:

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

I don't read that to say you can pass a NULL pointer for the value
parameter.

I read that as saying:

"If you want to send a NULL RPC parameter, you should set
datalen to 0, for both fixed or variable data types."

Bill

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of ZIGLIO,
Frediano, VF-IT
Sent: 03 December 2004 12:43
To: FreeTDS Development Group
Subject: RE: [freetds] stored proc parameters


>
> 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
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain or
redistribute it. Click here for important additional terms relating to this
e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------





Archive powered by MHonArc 2.6.24.

Top of Page