Skip to Content.
Sympa Menu

freetds - Re: [freetds] Numeric fields looks like floating point?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>, <zulu AT galaradio.com>
  • Subject: Re: [freetds] Numeric fields looks like floating point?
  • Date: Thu, 8 Sep 2005 10:58:11 -0400

> From: Alexander A. Vlasov
> Sent: Thursday, September 08, 2005 8:50 AM
>
> I noticed following strange behavior of FreeTDS: numeric columns
> appears like floating point. For example, if I create a test table
> (id numeric(8)), insert one value, say '1', into it and select *
> from this table with sqsh built with FreeTDS, I got a '1.000000'.
> But with isql, result is just '1'. Same thing with PHP built with
> FreeTDS.
>
> How can I correct this behavior? Thanks in advance.

What would "correct" be?

The server transmits your numeric(8) value in binary form, as a data
structure. The library provides the data to the application. It can
convert the data to another form -- integer, character, floating point
-- or not, according to the application's request.

As a carbon-based life form, you can't read bits. To interpret the
data, you need it converted to strings that can be rendered on your
screen. The application -- sqsh, isql, what have you -- converts the
data to character form for your viewing comfort. It's up to the
application to decide how to do that.

Numerics are normally used to avoid floating point approximations.
Representing them in decimal form with some fixed precision doesn't seem
wrong to me. Sure, it could take note of the scale and change its
rendering accordingly. If you think that's a good idea, well, you know.
The project accepts patches.

HTH.

--jkl

-----------------------------------------
The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
responsible
for delivering this message to the intended recipient, any review,
dissemination,
distribution or duplication of this communication is strictly prohibited. If
you are
not the intended recipient, please contact the sender immediately by reply
e-mail
and destroy all copies of the original message. Please note that we do not
accept
account orders and/or instructions by e-mail, and therefore will not be
responsible
for carrying out such orders and/or instructions. If you, as the intended
recipient
of this message, the purpose of which is to inform and update our clients,
prospects
and consultants of developments relating to our services and products, would
not
like to receive further e-mail correspondence from the sender, please "reply"
to the
sender indicating your wishes. In the U.S.: 1345 Avenue of the Americas, New
York,
NY 10105.




Archive powered by MHonArc 2.6.24.

Top of Page