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 11:21:17 -0600


I had the same problem...

Somebody suggest me change the tds_convert function but I was busy in
another project, but I finish yesterday to fix it. The wrong display is
because SPARC is a bigendian system...

Here is the patch. Just make "patch < convertpatch" on the top directory of
freetds, re-compile and try again...

--- src/tds/convert-orig.c Wed Jan 31 17:21:17 2001
+++ src/tds/convert.c Thu Feb 1 10:41:11 2001
@@ -532,7 +532,10 @@
{
TDS_USMALLINT days, minutes;
time_t tmp_secs_from_epoch;
-
+ #ifdef WORDS_BIGENDIAN
+ int i, n ;
+ #endif
+
switch(desttype) {
case SYBCHAR:
case SYBVARCHAR:
@@ -562,7 +565,16 @@
case SYBDATETIME:
break;
case SYBDATETIME4:
- memcpy(dest,src,sizeof(TDS_DATETIME4));
+ #ifdef WORDS_BIGENDIAN /* We need to swap the words */
+ n = sizeof(TDS_DATETIME4) ;
+ memset(dest, '\0', n ) ;
+ for ( i = 0; i < sizeof(TDS_DATETIME4) ; i += 2)
+ memcpy(dest + i, src + (n - 2) - i, 2) ;
+
+ #else
+ memcpy(dest,src,sizeof(TDS_DATETIME4));
+ #endif
+
return(sizeof(TDS_DATETIME4));
default:
return TDS_FAIL;



----- Original Message -----
From: "ZULU" <urbas AT nulleins.at>
To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
Sent: Thursday, February 01, 2001 10:24 AM
Subject: [freetds] GETDATE() Problems with MSSQL7-SP2 and Freetds 0.51 and
Solaris


> 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