Bug #863: PHP returns bad values for 'REAL' columns coming from sybase
| From: | bb26 at chrysler dot com | Date: | Wed, 21 Oct 1998 16:22:24 +0000 |
| Subject: | Bug #863: PHP returns bad values for 'REAL' columns coming from sybase | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-1937@lists.php.net to get a copy of this message | ||
From: bb26@chrysler.com
Operating system: AIX 4.3
PHP version: 3.0.5
PHP Bug Type: Sybase related
Bug description: PHP returns bad values for 'REAL' columns coming from sybase
This problem exists in 3.0.3 and 3.0.5 and probably other versions. Sybase versions tested were
11.0.3 and ASE 11.5.1 running on AIX 4.3 and Digital Unix 4.0d. PHP was running as an apache
(1.3.3) module on AIX 4.3 on 64-bit hardware.
The following patch fixes the problem for me, but someone else probably needs to try it out to make
sure I didn't break something else.
*** php3_sybase.h Sun Oct 4 20:22:42 1998
--- php3_sybase.h.new Wed Oct 21 11:43:37 1998
***************
*** 91,96 ****
--- 91,97 ----
#define anyintcol(j) (coltype(j)==SYBINT4?intcol(j):(coltype(j)==SYBINT2?small
intcol(j):tinyintcol(j)))
#define charcol(i) ((DBCHAR *) dbdata(sybase_ptr->link,i))
#define floatcol(i) ((float) *(DBFLT8 *) dbdata(sybase_ptr->link,i))
+ #define realcol(i) ((float) *(DBREAL *) dbdata(sybase_ptr->link,i))
typedef struct sybase_link_struct sybase_link;
*** sybase.c Sun Oct 4 20:23:05 1998
--- sybase.c.new Wed Oct 21 11:43:01 1998
***************
*** 626,634 ****
result->type = IS_STRING;
break;
}
! /*case SYBFLT8:*/
! case SYBREAL: {
result->value.dval = (double) floatcol(offset);
result->type = IS_DOUBLE;
break;
}
--- 626,637 ----
result->type = IS_STRING;
break;
}
! case SYBFLT8:
result->value.dval = (double) floatcol(offset);
+ result->type = IS_DOUBLE;
+ break;
+ case SYBREAL: {
+ result->value.dval = (double) realcol(offset);
result->type = IS_DOUBLE;
break;
}
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net