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:36:39 -0000

well,

if its (supposed to be) ignored, I guess it shouldn't care what the
value is...so you're not wrong.


Bill


-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Paparo, Joshua
Sent: 03 December 2004 13:32
To: FreeTDS Development Group
Subject: RE: [freetds] stored proc parameters


I forgot to mention I was indeed setting 'datalen' to zero for null
params but the bit I'm thinking of in the docs is:

"A pointer to the RPC parameter itself. If datalen is 0, this pointer
will be ignored and treated as NULL."

This made me think I could just pass a null pointer for 'value' as long
as 'datalen' was zero.

Josh

-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Thompson, Bill D
(London)
Sent: 03 December 2004 13:23
To: FreeTDS Development Group
Subject: RE: [freetds] stored proc parameters

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/
--------------------------------------------------------

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds



Notice to recipient:
The information in this internet e-mail and any attachments is
confidential and may be privileged. It is intended solely for the
addressee. If you are not the intended addressee please notify the
sender immediately by telephone. If you are not the intended recipient,
any disclosure, copying, distribution or any action taken or omitted to
be taken in reliance on it, is prohibited and may be unlawful.

When addressed to external clients any opinions or advice contained in
this internet e-mail are subject to the terms and conditions expressed
in any applicable governing terms of business or client engagement
letter issued by the pertinent Bank of America group entity.

If this email originates from the U.K. please note that Bank of America,
N.A., London Branch, Banc of America Securities Limited and Banc of
America Futures Incorporated are authorised and regulated by the
Financial Services Authority.

_______________________________________________
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