Skip to Content.
Sympa Menu

freetds - Re: checkins

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: checkins
  • Date: Wed, 5 Jun 2002 12:15:52 -0400


Hey james,

> My only complaint, if I may, is that the default default default format,
> before locales and/or customization, should emulate the vendors' format,
> which is "Jun 5 2002 10:15AM", no seconds or milliseconds (and only one
> space between the month and the day, regardless of the number of digits in
> the day). I think applications will break otherwise.

OK, I give in. Like I said before, I only tried to mimic the behaviour of
Sybase dbconvert() in my environment. It's clear that the truth is more
complicated than I thought...
I can do the changes easily, but I'll have to rework ny bcp code to get
the full date string another way (using dbdatecrack() perhaps). Let me
work on it...


> I don't use dbconvert much; I'm more familiar with dbbind. Is the destlen=
> -2 an enhancement or a Sybase feature? My MS docs don't show it. How do
> you know how many trailing blanks to add?
>
> For destlen >0, we have to pad with blanks and not null-terminate.
> Otherwise there's no way for the caller to know where the conversion ends
> and garbage begins (trailing blanks are easy to trim if the buffer length is
> known). Similarly, for destlen= -1, we have to null-terminate, because
> there's no way else to know where the conversion ends.
>
> The sqsh code distinquishes between conversions it does itself and default
> conversions. That's all I remember offhand. Thanks for the pointer; that
> will make it easier to track down.
>

destlen -2 is in my sybase manuals, so I copied it.

dbbind calls dbconvert. I also amended dbbind to use the -2 and -1
destlen's where appropriate.

The caller can know where the conversion ends, because the return code
from dbconvert gives the valid length. I've tried this with Sybases dblib,
e.g.
call dbconvert() to convert string "ABCDE" to a string. with destlen of 20
you get a returned value of "ABCDE " but a return code of 5!

sqsh seems to work on the length of the converted string. If I don't blank
pad it, it adjusts the display accordingly. Hmmmm.

I agree that we will have to take this forward so that we don't break any
current applications, as those apps may have been built around the way
that FreeTDS currently behaves...

I also think I'm gonna have to build the ultimate data conversion test
program that can be linked in with FreeTDS or Sybase. That way we may get
to the bottom of it all. Let me work on that as well...


Nice to be back,

Bill





Archive powered by MHonArc 2.6.24.

Top of Page