mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
Merge pull request #54252 from nextcloud/backport/54203/stable31
[stable31] fix: fix oci string length with empty strings
This commit is contained in:
commit
b09dfb03b7
2 changed files with 3 additions and 2 deletions
|
|
@ -80,12 +80,12 @@ class OCIFunctionBuilder extends FunctionBuilder {
|
|||
public function octetLength($field, $alias = ''): IQueryFunction {
|
||||
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
|
||||
$quotedName = $this->helper->quoteColumnName($field);
|
||||
return new QueryFunction('LENGTHB(' . $quotedName . ')' . $alias);
|
||||
return new QueryFunction('COALESCE(LENGTHB(' . $quotedName . '), 0)' . $alias);
|
||||
}
|
||||
|
||||
public function charLength($field, $alias = ''): IQueryFunction {
|
||||
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
|
||||
$quotedName = $this->helper->quoteColumnName($field);
|
||||
return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
|
||||
return new QueryFunction('COALESCE(LENGTH(' . $quotedName . '), 0)' . $alias);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,6 +370,7 @@ class FunctionBuilderTest extends TestCase {
|
|||
$result = $query->execute();
|
||||
$column = $result->fetchOne();
|
||||
$result->closeCursor();
|
||||
$this->assertNotNull($column);
|
||||
$this->assertEquals($bytes, $column);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue