Skip to Content.
Sympa Menu

freetds - Re: New build warnings; datetime format issue

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: New build warnings; datetime format issue
  • Date: Tue, 28 May 2002 13:20:13 -0400


> From: Bill Thompson [mailto:thompbil AT exchange.uk.ml.com]
> Sent: May 28, 2002 11:46 AM
>
> FreeTDS conversion routines (dbconvert in db-lib for example) used to
> convert a date to the string format "Jan 1 1800 12:00AM".
>
> However, I discovered that the real dbconvert routine ( in
> Sybase's db-lib)
> would output in the format "Jan 1 1800 12:00:00:000AM" , so
> I changed our version to do the same thing.
>
> My guess is that sqsh or isql doesn't simply print the output of the
> dbconvert routine, but post-formats the output, or uses dbdatecrack to
> give a "user-friendly" output - sans the seconds and milliseconds.

Bill,

I see where you're coming from, and we're both after the same thing:
behavior faithful to Sybase's libraries. That's good, it means we are only
experiencing a technical difficulty.

Last night I got to do a little more testing, having installed both sqsh and
Sybase isql on my Linux Sybase server. Withall, I came to a conclusion
different from yours.

On my server, sqsh is linked to Sybase's ct-lib. (That may be a clue, as
you were focussed on db-lib behavior).

On my client machine, I linked sqsh to the cvs version of FreeTDS.

I tried this query again:

select convert(datetime, '1/1/1800')

and got these results:

Sybase, isql: varchar(20) (approximately), right justified, format "Jan 1
1800 12:00AM".
Sybase, sqsh: varchar(30) (approximately), left justified, format "Jan 1
1800 12:00AM".
FreeTDS, sqsh: varchar(255), left justified, format "Jan 1 1800
12:00:00:000AM".

(I'm just eyeballing the output. They might be char rather than varchar,
and I'm estimating the sizes.)

Based on that output, I'd say sqsh relies on the library to pick a varchar
size and format. We can certainly say that the same source code is
rendering two different results with two different libraries.

I will look into this further, too, probably on Wednesday night. Maybe it's
completely a ct-lib thing, but in any event we'll have to reconcile the
client libraries with the tds layer somehow, to get consistent results for
all clients.

Scott Gray sent me an old version of sqsh that uses db-lib. (I want to turn
it into a connection debugger and db-lib illustration.) I haven't gotten it
to compile yet, mostly for .h file reasons, but maybe I'll give that another
go. It seems like it would be useful as we hash this out.

Hope the above is help.

Regards,
--jkl




Archive powered by MHonArc 2.6.24.

Top of Page