Re: Sending dbnumeric in dbrpcparam

Damien Churchill <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
2009/6/2 James K. Lowden <[email protected]>:
> 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.

Ah this does work, thanks!

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

Do you mean that freetds currently does not support sending these types?

Damien
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.