workaround bug in OCI PDO driver

This commit is contained in:
El RIDO 2022-01-23 21:24:28 +01:00
parent 0be55e05bf
commit 8d63921924
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

View File

@ -583,9 +583,17 @@ class Database extends AbstractData
{
$statement = self::$_db->prepare($sql);
$statement->execute($params);
$result = $firstOnly ?
$statement->fetch(PDO::FETCH_ASSOC) :
$statement->fetchAll(PDO::FETCH_ASSOC);
if ($firstOnly) {
$result = $statement->fetch(PDO::FETCH_ASSOC);
} elseif (self::$_type === 'oci') {
// workaround for https://bugs.php.net/bug.php?id=46728
$result = array();
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
$result[] = $row;
}
} else {
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
}
$statement->closeCursor();
if (self::$_type === 'oci' && is_array($result)) {
// returned column names are all upper case, convert these back