Skip to Content.
Sympa Menu

freetds - RE: Strange conversion

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: ZIGLIO Frediano <Frediano.Ziglio AT vodafoneomnitel.it>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: RE: Strange conversion
  • Date: Mon, 5 Aug 2002 14:03:33 +0200


>
> Freddy,
>
> Indeed it appears that "server side" conversions using
> convert(), are NOT
> the same as client side conversions using cs_convert() !
>

You are right, just curiosity.
In second part I tested ODBC/bit conversion.
ODBC treat bit as numeric (with range 0..1) and strip spaces (not accept '-
1' as integer)

> in isql (open client 11 using ct-lib), "select convert(int,
> '- 13 ')"
> returns -13 , as in your example.
>
> However if I write a bespoke program to select '- 13 ' into
> a character
> variable, and then try to convert it to an int using
> cs_convert(), I get the
> following:
>
> CS-Library error: LAYER = (2) ORIGIN = (4) SEVERITY = (1)
> NUMBER = (24)
> cs_convert: cslib user api layer: common library error: The
> conversion/operation was stopped due to a syntax error in the
> source field.
>
> Now, OUR convert_code, when converting a char to int type,
> just does an
> "atoi". We don't try and trap any error returned from atoi, nor do any
> "parsing" of the field to make sure it represents a valid value.
> I've tried capturing the value of "errno" after passing atoi
> an invalid
> value, with little success. On SUN at least , this doesn't
> seem to work as
> the man pages suggest...
>
> I think we'd have to actually parse the input data - stripping out
> whitespace and making sure the remaining characters make
> sense (optional
> leading sign, remainder all numeric ).
>
> HTH,
>
> Bill
>
I think so.
I'm writing a test for all conversion possible (using cs_convert for the
moment).
Can you try conversion to bit (like 2,1,0,-1 to bit and '2',' 1 ',' -1 '
to bit).

freddy77

=================================
"STRICTLY PERSONAL AND CONFIDENTIAL

This message may contain confidential and proprietary material for the sole
use of the intended recipient. Any review or distribution by others is
strictly prohibited. If you are not the intended recipient please contact
the sender and delete all copies.
The contents of this message that do not relate to the official business of
our company shall be understood as neither given nor endorsed by it."

=================================




Archive powered by MHonArc 2.6.24.

Top of Page