Skip to Content.
Sympa Menu

freetds - Re: SQL 7.0 Dates not coming through properly

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Schaal <mark AT champ.tstonramp.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: SQL 7.0 Dates not coming through properly
  • Date: Thu, 22 Jun 2000 15:09:50 -0700 (PDT)


>
> I've got a SQL 7.0 Desktop db server on an NT box. When accessing this db
> thorugh PHP (compiled with sybase support pointing at the freetds
> libraries), if I include a date field in the query, my PHP returns bad data.
> Also, on a Sun box accessing the same database with the Sybase CT libraries,
> we are getting strange date returns. Dates that should be one day apart in
> 1996, are showing up as 25 Jan 1900 8:50 and 25 Jan 1900 8:53, etc.
>
> We have SQL 6.5 databases that work fine on the Sun box. The fact that I've
> seen this with two different libraries makes me wonder if SQL 7.0 is broken
> wrt the sybase protocol when it comes to dates.
>
> Has anyone had dates work properly with SQL 7.0?
>
> Tim Wasson
> Koch Industries
> Wichita KS USA


I noticed there is a fix in the code, but I think it parses the
TDS_LOGIN_ACK_TOKEN incorrectly. Try the following patch, i.e.
move the "tds_get_n(tds, NULL, len-4);" call down two lines.
Let us know if it works. (I've got to find time to start testing
of this stuff.)


*** token.c.orig Thu Jun 22 15:00:49 2000
--- token.c Thu Jun 22 15:06:20 2000
***************
*** 170,178 ****
case TDS_LOGIN_ACK_TOKEN:
len = tds_get_smallint(tds);
ack = tds_get_byte(tds);
- tds_get_n(tds, NULL, len-4);
major_ver = tds_get_byte(tds);
minor_ver = tds_get_byte(tds);
tds_get_byte(tds);
#ifdef HW_BIG_ENDIAN
if (major_ver==7) {
--- 170,178 ----
case TDS_LOGIN_ACK_TOKEN:
len = tds_get_smallint(tds);
ack = tds_get_byte(tds);
major_ver = tds_get_byte(tds);
minor_ver = tds_get_byte(tds);
+ tds_get_n(tds, NULL, len-4);
tds_get_byte(tds);
#ifdef HW_BIG_ENDIAN
if (major_ver==7) {

Mark
--
Mark J. Schaal Phone: (909) 620-7724
TST On Ramp Fax: (909) 620-8174
System Administrator E-Mail: mark AT tstonramp.com




Archive powered by MHonArc 2.6.24.

Top of Page