#21841 [Opn->Csd]: Numeric fields converted to int

From: Date: Thu, 23 Jan 2003 15:02:55 +0000
Subject: #21841 [Opn->Csd]: Numeric fields converted to int
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31064@lists.php.net to get a copy of this message
ID: 21841 Updated by: iliaa@php.net Reported By: herouth@itouch.co.il -Status: Open +Status: Closed Bug Type: Sybase-ct (ctlib) related Operating System: Linux PHP Version: 4.3.0 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2003-01-23 07:58:55] herouth@itouch.co.il When querying a sybase (11.9.2) table field which is defined as numeric(12,6), on the first fetch, the value is typed "float". On the next fetch and onwards, the value is typed "int", so the fractional part is lost. This behavior did not exist in PHP 4.1, where values were typed "string" when they were numeric. Example: (Run in isql) CREATE TABLE sometable ( val numeric(12,6) ) go INSERT INTO sometable VALUES (15.5) INSERT INTO sometable VALUES (14.4) INSERT INTO sometable VALUES (12.33) INSERT INTO sometable VALUES (17.18) go (PHP script) <?php header( 'Content-type: text/plain' ); $conn = sybase_connect( 'host', 'user', 'password' ); sybase_select_db( 'user', $conn ); $res = sybase_query( "SELECT val FROM sometable" ); while ( false !== ( $rec = sybase_fetch_row( $res ) ) ) { echo "val = $rec[0]\n"; } ?> (displayed result) val = 15.5 val = 14 val = 12 val = 17 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21841&edit=1

« previous php.bugs (#31064) next »