|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-11-26 03:24 UTC] jear at aabc dot dk
Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object (Windows NT).
Numbers stored as an InterBase/Firebird numeric/decimal datatype beyond the bounds of the PHP integer type (> 2147483647), do not return a float type but cause an overflow
Example:
2303511415 (decimal 10,0) returns -1991455881
PHP/Firebird example script:
$sql = "create table temp (large_number numeric(10,0))";
$result = ibase_query($sql,connection());
if (!$result) {
exit;
}
$sql = "INSERT INTO temp VALUES (2303511415)";
$result = ibase_query($sql,connection());
if (!$result) {
exit;
}
$sql = "SELECT large_number FROM temp WHERE large_number = 2303511415";
$result = ibase_query($sql,connection());
if (!$result) {
exit;
}
while ($row = ibase_fetch_row($result)) {
print($row[0]);
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 21:00:01 2025 UTC |
Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object (Windows NT). Numbers stored as an InterBase/Firebird numeric/decimal datatype beyond the bounds of the PHP integer type (> 2147483647), do not return a float type but cause an overflow Example: 2303511415 (decimal 10,0) returns -1991455881 PHP/Firebird example script: $sql = "create table temp (large_number numeric(10,0))"; $result = ibase_query($sql,connection()); if (!$result) { exit; } ibase_commit(); $sql = "INSERT INTO temp VALUES (2303511415)"; $result = ibase_query($sql,connection()); if (!$result) { exit; } $sql = "SELECT large_number FROM temp WHERE large_number = 2303511415"; $result = ibase_query($sql,connection()); if (!$result) { exit; } while ($row = ibase_fetch_row($result)) { print($row[0]); } ibase_free_result($result); $sql = "drop table temp"; $result = ibase_query($sql,connection()); if (!$result) { exit; } ibase_commit();