From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.3.0
PHP Bug Type:     Sybase-ct (ctlib) related
Bug description:  Numeric fields converted to int

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 bug report at http://bugs.php.net/?id=21841&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21841&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21841&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21841&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21841&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21841&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21841&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21841&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21841&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21841&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21841&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21841&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21841&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21841&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21841&r=gnused

Reply via email to