freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "David Nsengiyumva" <davidn AT finsolutions.co.za>
- To: <freetds AT lists.ibiblio.org>
- Subject: [freetds] Numeric data types
- Date: Wed, 10 Dec 2003 18:05:50 +0200
THANX BILL,
> I can kind of see where the problem lies, but can you tell me ...
>
> a) what is the host variable you have bound the numeric column to ? is it
a
> CS_NUMERIC type ?
YES IT IS.....CS_NUMERIC
> b) how have you set up the DATAFMT structure (third argument to ct_bind()
> when you bind the numeric columns ?
>
I CALL FIRST 'ct_results' AND THEN I DO CALL 'ct_describe' WITH A
DECLARED
datafmt. THE 'ct_describe' FUNCTION
SETS THE MEMBERS OF THE datafmt AND THEN I USE IT AS A THIRD
PARAMETER TO
THE 'ct_bind' FUNCTION.
I DON'T WANT TO HARD CODE THE datafmt BECAUSE IT SHOULD BE DYNAMIC AS
I
DON'T KNOW AHEAD THE DATA TYPE OF
RESULT. THIS SHOULD BE ACHIEVED THOUGHT WITH THE 'ct_describe'
FUNCTION.
LET ME KNOW WHAT YOU THINK AND THANX A LOT FOR YOUR RESPONSE
> Bill
>>> -----Original Message-----
>>> From: David Nsengiyumva [SMTP:davidn AT finsolutions.co.za]
>>> Sent: 10 December 2003 14:00
>>> To: freetds AT lists.ibiblio.org
>>> Subject: [freetds] Numeric data types
>>>
>>> Hi there,
>>>
>>> I am having problems with SQL queries that return numeric and date data
>>> types. First of all I am accessing a MS SQL Server 2000 from a Win2000
>>> machine and I am using FreeTDS-0.61.2.
>>> The Problem happens in the 'cs_convert' function. The 'if (src_type ==
>>> desttype)' succeed and the switch statement 'switch(desttype)' goes to
>>> the
>>> SYBBITN, SYBNUMERIC, SYBDECIMAL case and since 'src_len > destlen' then
>>> the
>>> function returns CS_FAIL. Basically src_len=35 and destlen=17.
>>>From what I can think of is that when I receive data (fecthing data) I
>>> read
>>> 17 bytes (that's where destlen=17 comes from) but the allocated space is
>>> 35
>>> (from the struct tdsnumeric)
>>>
>>> typedef struct tdsnumeric
>>> {
>>> unsigned char precision;
>>> unsigned char scale;
>>> unsigned char array[33]; // why this ?????
>>> } TDS_NUMERIC;)
>>>
-
[freetds] Numeric data types,
David Nsengiyumva, 12/10/2003
- <Possible follow-up(s)>
- RE: [freetds] Numeric data types, Thompson, Bill D (London), 12/10/2003
- [freetds] Numeric data types, David Nsengiyumva, 12/10/2003
- RE: [freetds] Numeric data types, Thompson, Bill D (London), 12/10/2003
Archive powered by MHonArc 2.6.24.