Skip to Content.
Sympa Menu

freetds - Re: [freetds] Sending dbnumeric in dbrpcparam

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Sending dbnumeric in dbrpcparam
  • Date: Tue, 1 Sep 2009 10:06:08 +0200

2009/6/2 Frediano Ziglio <freddy77 AT gmail.com>:
> 2009/6/2 James K. Lowden <jklowden AT freetds.org>:
>> Damien Churchill wrote:
>>> >> Here is the code that I've tried: http://pastebin.com/f69a761d7
>>> >
>>> > http://manuals.sybase.com/onlinebooks/group-cnarc/cng1110e/dblib/@Generic__BookTextView/34413;pt=39614
>>> >
>>> >        "The value of type indicates the datatype of *value. See
>>> > "Types" for more information. For types that have no C equivalent,
>>> > such as SYBDATETIME, SYBMONEY, SYBNUMERIC, or SYBDECIMAL, use
>>> > dbconvert_ps to initialize *value."
>>>
>>> Hmm, I gave this a try and it still fails with the same error.
>>
>> Um, that's not possible?  The advice is to convert your numeric value to a
>> "known" type -- a C string, say -- and bind your parameter to that
>> (intermediate) buffer.  Line 63 becomes:
>>
>> ret = dbrpcparam(dbproc, "@idecimal", 0, SYBCHAR, -1, strlen(tmp), (BYTE
>> *)tmp);
>>
>> At that point, it's just a plain-vanilla RPC call.
>>
>>> Would this only work with Sybase perhaps?
>>
>> It should work regardless of TDS protocol.  The server interaction is
>> different, but the API (and its limitations) are the same.
>>
>> FWIW, there's no technical reason dbrpcparam couldn't deal directly with
>> these types.  It's not specified by the vendors, but it's a reasonable
>> extension.  In case you want to try your hand at it.
>>
>> HTH.
>>
>
> I tried to add test to our unittests (attached) and it seems that
> client library doesn't fill correctly needed informations for numeric
> (precision and scale). I did also a small change to dblib. However I
> would check if DBDECIMAL declaration is different between Sybase and
> Microsoft. It seems for instance that Sybase use big endian order
> while MS use little endian.
>

Committed patch. Note however that MS ABI is currently a bit different
as we use Sybase ABI for DBDECIMAL/DBNUMERIC.

freddy77



  • Re: [freetds] Sending dbnumeric in dbrpcparam, Frediano Ziglio, 09/01/2009

Archive powered by MHonArc 2.6.24.

Top of Page