Skip to Content.
Sympa Menu

freetds - Re: invalid data returned when querying data of type:REAL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT umcc.ais.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: invalid data returned when querying data of type:REAL
  • Date: Tue, 4 Apr 2000 07:54:33 -0400 (EDT)


This is a bug in PHP 3.0.11 and higher (at least 3.0.4 is the last know
working one, but I haven't tested 5->10). I've replicated this under real
sybase dblib on AIX too. Using --with-sybase-ct does correct the problem.
The offending line from the header file (php3_sybase.h) is this:

#define floatcol(i) ((float) *(DBFLT8 *) dbdata(sybase_ptr->link,i))

>From the looks of it somebody fixed floats by commenting then out of the
switch in sybase.c and letting dbconvert() take care of it. You could do
the same with reals:

/*case SYBFLT8:*/
case SYBREAL: {
result->value.dval = (double) floatcol(offset);
result->type = IS_DOUBLE;
break;
}

becomes:

/*case SYBFLT8:*/
/*
** floatcol() mangles the 4byte reals, so let dbconvert handle it -- bsb
case SYBREAL: {
result->value.dval = (double) floatcol(offset);
result->type = IS_DOUBLE;
break;
}
*/

Unfornately, that runs into a second problem of extraneous text trailing
the number, which I don't have time to look at right now.

I'll try to look at it more tonight and get a patch together for the php
folks.

Brian

On Mon, 3 Apr 2000, Jamie Steffen wrote:

> All's well on this front aside from one minor exception. When a query from
> our SQL database (v.6.5) is made from a field of type:REAL the return is
> always '0'. Has anyone come across this issue or is anyone aware of it? All
> other queries made return the correct results.





Archive powered by MHonArc 2.6.24.

Top of Page