1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

OracleDriver: cast type NUMBER(p, 0) as an INTEGER

In many cases, Oracle returns integers as a NUMBER(8,0). Type NUMBER is casted to (float) which is unnecessary in this case.
This commit is contained in:
Miloslav Hůla
2015-04-17 15:22:45 +02:00
parent 64b3d0c6f4
commit 999f51a7bd

View File

@@ -365,11 +365,12 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
$count = oci_num_fields($this->resultSet);
$columns = array();
for ($i = 1; $i <= $count; $i++) {
$type = oci_field_type($this->resultSet, $i);
$columns[] = array(
'name' => oci_field_name($this->resultSet, $i),
'table' => NULL,
'fullname' => oci_field_name($this->resultSet, $i),
'nativetype'=> oci_field_type($this->resultSet, $i),
'nativetype' => $type === 'NUMBER' && oci_field_scale($this->resultSet, $i) === 0 ? 'INTEGER' : $type,
);
}
return $columns;