Skip to Content.
Sympa Menu

freetds - Re: still not working

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Wasson, Tim" <WassonT AT kochind.com>
  • To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: still not working
  • Date: Wed, 5 Jul 2000 09:20:02 -0500


I've also experienced some funny errors when hitting SQL 7.0 from
Linux/PHP/Apache when the returned data has a DATE field in it:

I would get errors and blank pages when I ran a query, but the connects
would work fine. Mark sent me a simple change for the token.c file, and I
tried it and it worked fine.

As far as using the mssql commands in PHP - my understanding is that they
actually execute the equivalent sybase command, so saying mssql_connect is
exactly the same to php as saying sybase_connect.

Here is the reply from Mark about what to change to fix the date problem: It
fixed mine!

Good luck, it does work, so don't give up.
Tim Wasson
Koch Industries
Wichita, KS


>
> 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



> -----Original Message-----
> From: Bob Kline [SMTP:bkline AT rksystems.com]
> Sent: Tuesday,July 04,2000 11:06 AM
> To: TDS Development Group
> Subject: [freetds] Re: still not working
>
> On Tue, 4 Jul 2000, Andrius Lokotash wrote:
>
> >
> > Hi all.
> >
> > We hawe still problems with it, ....
>
> One more suggestion ...
>
> > (we are using php 4)
> > freetds:
> > ./configure --with-tdsver=4.2
> > php:
> > ./configure --with-mysql --with-apache=
> > (path) --enable-sigchild --enable-ttf --with-sybase=/usr/local/freetds/
> >
> > php is compiled with apache (both from sources)
> >
> > script part: (test.php)
> >
> > mssql_connect("hostip","username","password"); as usual :)
> > mssql_select_db("dbname");
> > $sql="select * from table";
> > $res=mssql_query($sql);
> > $row=mssql_fetch_row($res);
> > echo $row[0];
> >
>
> You should match up the functions you're using with the configuration
> you specified at build time. You're currently invoking mssql_xxx()
> functions but you built with mysql and sybase support. I would guess
> that it will be more likely to work if you invoke the sybase_xxx()
> functions. NB: mysql and mssql are *not* the same thing. :->}
>
> HTH.
>
> Bob
>
>
> ---
> You are currently subscribed to freetds as: WassonT AT kochind.com
> To unsubscribe, forward this message to
> $subst('Email.Unsub')
>





Archive powered by MHonArc 2.6.24.

Top of Page