Skip to content

Integer columns are being converted to string #5

@wmiguellima

Description

@wmiguellima

Description

The following code:

$conn = oci_connect('DB', 'PASSWORD', '172.17.0.1:51521/XEPDB1');

if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}

$stid = oci_parse($conn, 'SELECT * FROM table');
oci_execute($stid);

while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    foreach ($row as $item) {
      echo gettype($item) . ' | ';
    }
}

Resulted in this output:

string | object | string |

But I expected this output instead:

integer | object | integer |

Problem:

The integer columns are being converted to strings.

Using CAST is not an option.

Possible solution:

Something like PDO::ATTR_STRINGIFY_FETCHES available on de sqlserver pdo

PHP Version

PHP 8.1

Operating System

Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions