Skip to Content.
Sympa Menu

freetds - Re: support for decimals, TDS_NUMERIC

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Bill Thompson" <thompbil AT exchange.uk.ml.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: support for decimals, TDS_NUMERIC
  • Date: Tue, 11 Jun 2002 03:28:14 -0400


Hey Mark,

> From looking around the code, it looks like there is no support for
> accessing the data from numeric data types... is this correct? The
> tds code seems to convert it to a TDS_NUMERIC structure in place, but
> I don't see code in ctlib or dblib that is using that.
>
> There was code in src/tds/token.c up until version 1.20 (checked in
> this morning by jkl) that did some checks for issues of sybase v.
> microsoft, but that's gone now (along with comments describing the
> wire protocol differences).
>


As far as I know, although the code in this area has been changed
(rationalised) by myself, the decimal/numeric stuff should all still work.
Please let me know if it doesn't, and what the symptoms are. I took out
all the comments regarding the wire protocol differences, and James was
kind enough to commit my changes. Perhaps I should have left the comments
in...

Briefly, I decided to hide this complexity inside the tds_swap_datatype()
function, rather than keeping it in the tds_process_row() function. It
seemed to me to better belong there.

FYI I have just done the following test:

in query analyzer:
>>
create table num_test ( col1 numeric(38,8), col2 numeric(8,2))
insert num_test values (12345678901234567890.12345678, 123456.78)
<<
then, using sqsh (1.7) linked with the latest snapshot of freetds:

$ ./sqsh -S MYSERVER -U myuser -P mypass -c -w 132
sqsh-1.7 Copyright (C) 1995-1999 Scott C. Gray
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
1> select * from num_test
2>
col1 col2
----------------------------------------- -----------
12345678901234567890.12345678 123456.78

(1 row affected)
1>

HTH

Bill





Archive powered by MHonArc 2.6.24.

Top of Page