Skip to content

Commit

Permalink
fix Oracle long string literal to CLOB split
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Jul 5, 2022
1 parent 4e2c0fe commit e585ab2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Persistence/Sql/Oracle/ExpressionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ protected function updateRenderBeforeExecute(array $render): array
$newParamBase = $this->paramBase;
$newParams = [];
$sql = preg_replace_callback(
'~\'(?:\'\'|\\\\\'|[^\'])*+\'\K|:\w+~s',
'~\'(?:\'\'|\\\\\'|[^\'])*+\'|:\w+~s',
function ($matches) use ($params, &$newParams, &$newParamBase) {
if ($matches[0] === '') {
return '';
if (str_starts_with($matches[0], '\'')) {
$value = str_replace('\'\'', '\'', substr($matches[0], 1, -1));
if (strlen($value) <= 4000) {
return $matches[0];
}
} else {
$value = $params[$matches[0]];
}

$value = $params[$matches[0]];
if (is_string($value) && strlen($value) > 4000) {
$expr = $this->convertLongStringToClobExpr($value);
unset($value);
Expand Down

0 comments on commit e585ab2

Please sign in to comment.