Skip to Content.
Sympa Menu

freetds - Re: Timestamp fields.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Timestamp fields.
  • Date: Tue, 27 Feb 2001 18:17:02 -0500 (EST)



Ok, here's a patch that will make it work. Unfortunately I have a bunch
of other pending changes that I haven't got completely working...so you'll
have to patch by hand instead of me checking this into CVS yet.

In src/tds/convert.c in the function tds_convert_binary make the section
between 'case SYBCHAR:' and 'case SYBBINARY:' look like this:


case SYBCHAR:
case SYBVARCHAR:
/* FIX ME */
if (destlen>=0 && destlen<3) {
return 0;
}
d=0;
dest[d++]='0';
dest[d++]='x';

/* length = -1 means assume dest is large enough, ugly */
if (destlen==-1) {
for (s=0;s<srclen;s++,d+=2) {
dest[d]=src[s]/16 > 9 ? 87 + (src[s]/16) : '0' + (src[s]/16);
dest[d+1]=src[s]%16 > 9 ? 87 + (src[s]%16) : '0' +
(src[s]%16);
}
} else {
for (s=0;s<srclen && d < destlen-2;s++,d+=2) {
dest[d]=src[s]/16 > 9 ? 87 + (src[s]/16) : '0' + (src[s]/16);
dest[d+1]=src[s]%16 > 9 ? 87 + (src[s]%16) : '0' +
(src[s]%16);
}
}
dest[d++]='\0';
return d;
case SYBBINARY:

On Tue, 27 Feb 2001, Tim Uckun wrote:

> It seems that the timestamp fields are not fully supported by free tds and
> or php.
>
> the following query fails with "document contained no data" error
>
> select upsize_ts from tblclients where id=6657
>
> Both of these queries return a blank but at least it does not crash
>
> Select cast (upsize_ts as datetime) as TS from tblclients where id=6657
> Select cast (upsize_ts as varchar) as TS from tblclients where id=6657
>
> The following query also fails with Document contained no data error
>
> select * from tblClients where id = 657
>
>
> Using freetds cvs snapshot --with-tdsver=4.2 php4.04 and the sybase
> functions
>
> If I build tds with version 7.0 only the casting as varchar works casting
> as datetime causes a numeric overflow
>
> Also the bit fields still don't work properly with tdsver=7 both when bit
> fields are true.
>
> :wq
> Tim Uckun
> Due Diligence Inc. http://www.diligence.com/ Americas Background
> Investigation Expert.
> If your company isn't doing background checks, maybe you haven't considered
> the risks of a bad hire.
>
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page