Skip to Content.
Sympa Menu

freetds - changes overnight

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James K. Lowden <jklowden AT speakeasy.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: changes overnight
  • Date: Tue, 6 Aug 2002 03:10:13 -0400


All,

I didn't apply any patches last night, but added a few things to help Bill
along with convert.c.

char->tinyint was not checking for negative values. Negative values
should fail to convert. Now they do: dbconvert returns 0 if the input
buffer evaluates to a value between 0 and 255.

dbconvert was not noticing if tds_convert returned zero, but continued on
with its processing. Result was garbage in dest if the conversion failed
(e.g., 'adbc'->datetime). Didn't look at the other APIs.

Bill, I took up the dare in your comments to write a better hex->int
algorithm. See what you think. If you like my version, we can delete the
"cruddy" one.

Sybase allows embedded blanks -- as Bill discovered -- in char->int. I
wrote tds_atoi() and used a macro to route all atoi() calls through it.
That solves that, say I.

While on the topic, Sybase does not similarly handle embedded blanks in
char->float. Neither do we. An interesting and scary test would be to
embed some other non-printable characters (say, tab, or NL, or ^D) in a
character string and try to convert it to an int. Imagine the sheer
wonder of discovery!

The atoll() testing has been corrected (I hope) and used in the places
David Varley pointed out. Always glad to support the burgeoning Tru64
community.

Since no one objected, DBDEAD() is now dbdead(), with an uppercase macro
in tds.h for those who need it.

ChangeLog follows.

--jkl

Tue Aug 6 00:16:34 EDT 2002 JK Lowden <jklowden AT schemamania.org>
+ include/tds.h.in cosmetic changes
+ include/sybdb.h changed DBDEAD to dbdead; provided macro.
Aids binary compatibility.
+ src/dblib/dblib.c dbconvert returns 0 if tds_convert returns
0
+ src/tds/convert.c char->tinyint disallows <0
char->int allows embedded spaces
hex->int is more efficient




Archive powered by MHonArc 2.6.24.

Top of Page