sanitize both single rows and multiple ones
This commit is contained in:
parent
b54308a77e
commit
b133c2e233
1 changed files with 20 additions and 5 deletions
|
@ -585,10 +585,9 @@ class Database extends AbstractData
|
||||||
if (self::$_type === 'oci' && is_array($result)) {
|
if (self::$_type === 'oci' && is_array($result)) {
|
||||||
// returned column names are all upper case, convert these back
|
// returned column names are all upper case, convert these back
|
||||||
// returned CLOB values are streams, convert these into strings
|
// returned CLOB values are streams, convert these into strings
|
||||||
$result = array_combine(
|
$result = $firstOnly ?
|
||||||
array_map('strtolower', array_keys($result)),
|
self::_sanitizeOciRow($result) :
|
||||||
array_map('self::_sanitizeClob', array_values($result))
|
array_map('self::_sanitizeOciRow', $result);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -839,7 +838,7 @@ class Database extends AbstractData
|
||||||
*
|
*
|
||||||
* From: https://stackoverflow.com/questions/36200534/pdo-oci-into-a-clob-field
|
* From: https://stackoverflow.com/questions/36200534/pdo-oci-into-a-clob-field
|
||||||
*
|
*
|
||||||
* @access private
|
* @access public
|
||||||
* @static
|
* @static
|
||||||
* @param int|string|resource $value
|
* @param int|string|resource $value
|
||||||
* @return int|string
|
* @return int|string
|
||||||
|
@ -865,6 +864,22 @@ class Database extends AbstractData
|
||||||
return preg_replace('/[^A-Za-z0-9_]+/', '', self::$_prefix . $identifier);
|
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
|
* upgrade the database schema from an old version
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue