sanitize both single rows and multiple ones

This commit is contained in:
El RIDO 2022-01-23 07:32:28 +01:00
parent b54308a77e
commit b133c2e233
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
1 changed files with 20 additions and 5 deletions

View File

@ -585,10 +585,9 @@ class Database extends AbstractData
if (self::$_type === 'oci' && is_array($result)) {
// returned column names are all upper case, convert these back
// returned CLOB values are streams, convert these into strings
$result = array_combine(
array_map('strtolower', array_keys($result)),
array_map('self::_sanitizeClob', array_values($result))
);
$result = $firstOnly ?
self::_sanitizeOciRow($result) :
array_map('self::_sanitizeOciRow', $result);
}
return $result;
}
@ -839,7 +838,7 @@ class Database extends AbstractData
*
* From: https://stackoverflow.com/questions/36200534/pdo-oci-into-a-clob-field
*
* @access private
* @access public
* @static
* @param int|string|resource $value
* @return int|string
@ -865,6 +864,22 @@ class Database extends AbstractData
return preg_replace('/[^A-Za-z0-9_]+/', '', self::$_prefix . $identifier);
}
/**
* sanitizes row returned by OCI
*
* @access private
* @static
* @param array $row
* @return array
*/
private static function _sanitizeOciRow($row)
{
return array_combine(
array_map('strtolower', array_keys($row)),
array_map('self::_sanitizeClob', array_values($row))
);
}
/**
* upgrade the database schema from an old version
*