Skip to content

Commit 05ef713

Browse files
committed
fix: fix oci string length with empty strings
Signed-off-by: Robin Appelman <[email protected]>
1 parent 8380ae1 commit 05ef713

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ public function groupConcat($expr, ?string $separator = ','): IQueryFunction {
8181
public function octetLength($field, $alias = ''): IQueryFunction {
8282
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
8383
$quotedName = $this->helper->quoteColumnName($field);
84-
return new QueryFunction('LENGTHB(' . $quotedName . ')' . $alias);
84+
return new QueryFunction('COALESCE(LENGTHB(' . $quotedName . '), 0)' . $alias);
8585
}
8686

8787
public function charLength($field, $alias = ''): IQueryFunction {
8888
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
8989
$quotedName = $this->helper->quoteColumnName($field);
90-
return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
90+
return new QueryFunction('COALESCE(LENGTH(' . $quotedName . '), 0)' . $alias);
9191
}
9292
}

0 commit comments

Comments
 (0)