Skip to Content.
Sympa Menu

freetds - Re: GETDATE() Problems with MSSQL7-SP2 and Freetds 0.51 and Solaris

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Ramiro Vázquez <lrvazquez AT megared.net.mx>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: GETDATE() Problems with MSSQL7-SP2 and Freetds 0.51 and Solaris
  • Date: Thu, 1 Feb 2001 17:37:58 -0600


I have MS-SQL 7 SP1 on Windows 2000 and Windows NT, accesing from both
solaris 7 and 8.

The anormal behavior displaying date is wrong in all cases...
I commented out the lines "broken_dates=1" and it still wrong...
freetds-0.51 packet :
1> select getdate() ;

-------------------
Dec 10 2026 10:26PM

commented out "broken_dates=1"
1> select getdate() ;

-------------------
Feb 04 1923 03:57PM

I look that the order maybe is in WORDS more than BYTES...
Maybe I wrong, but I putting tdsdump_log showing both src and dest data
inside of _ct_bind_data() function just after it call to tds_convert ...
there aren't differences between original packet and commented out
"broken_dates=1", but after apply the patch the diferences appears.

Part of log before the patch ( both original and commented out versions )
Display : "Oct 13 1902 03:01PM" wrong

inside _ct_bind_data() converting column 0 from type 111 to type 58
inside _ct_bind_data() setting source length for 0 = 4
inside _ct_bind_data() conversion done src[0-3] = 3, 222, 144, 37
inside _ct_bind_data() conversion done dest[0-3] = 3, 222, 144, 37
inside _ct_bind_data() conversion done len = 4 bindfmt = 0
inside _ct_bind_data() length binding len = 4
inside _ct_get_server_type()
inside _ct_get_server_type()
inside tds_convert_datetime4() days = 990 minutes = 36901
inside ct_fetch()
processing row tokens. marker is fd

Diff after appliying the patch...
Display : Jan 12 2001 04:30PM ( correct )
< inside _ct_bind_data() conversion done src[0-3] = 3, 222, 144, 37
> inside _ct_bind_data() conversion done dest[0-3] = 144, 37, 3, 222
163c163
< inside tds_convert_datetime4() days = 990 minutes = 36901
> inside tds_convert_datetime4() days = 36901 minutes = 990

Ramiro.

----- Original Message -----
From: "Brian Bruns" <camber AT ais.org>
To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
Sent: Thursday, February 01, 2001 4:49 PM
Subject: [freetds] Re: GETDATE() Problems with MSSQL7-SP2 and Freetds 0.51
and Solaris


>
> SQL Server 7.0 GA and SP1 had broken date handling from big endian
> machines....A patch was applied to work around it. Unfortunately it is
> fixed in SP2, but there is no way to tell the difference between them.
> So if you look in convert.c you'll see a section of code that looks like:
>
> if (major_ver==7) {
> tds->broken_dates=1;
> }
>
> just comment that out and recompile and you should be set. However it
> should be noted that you will now have broken date handling on SQL 7
> servers < SP2.
>
> Cheers,
>
> Brian
>
> On Thu, 1 Feb 2001, ZULU wrote:
>
> > hi
> >
> > On our developmentmachine we are using linux - there all SQL statements
> > work fine. Our client machine is an
> > SunOS 5.6 Generic_105181-19 sun4u sparc SUNW,Ultra-4 this is the only
> > known difference.
> > The porblems occures in all date related SQL funtions, I dont know if
> > Insert statements work fine but the select statements equal on rows or
on
> > integrated functions like getdate or Current_timestamp produce no valid
> > days.
> >
> > Datetime fields returns always Feb 07 2036 06:30A.
> > Getdate and Current_timestamp return an date between 1900 and 2036 -
> > growing all time to the maximum and starts again
> >
> > Hm
> > Hope somebody finds an answer.
> >
> > mfg Gerald Urbas
> >
>
>
> ---
> You are currently subscribed to freetds as: [lrvazquez AT megared.net.mx]
> To unsubscribe, forward this message to
$subst('Email.Unsub')





Archive powered by MHonArc 2.6.24.

Top of Page