Browse Source

Fix LENGTH function name across databases

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v24.0.0beta2
Côme Chilliet 2 years ago
parent
commit
7407a324d9
No account linked to committer's email address

+ 1
- 1
lib/private/DB/QueryBuilder/FunctionBuilder/FunctionBuilder.php View File

public function charLength($field, $alias = ''): IQueryFunction { public function charLength($field, $alias = ''): IQueryFunction {
$alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : ''; $alias = $alias ? (' AS ' . $this->helper->quoteColumnName($alias)) : '';
$quotedName = $this->helper->quoteColumnName($field); $quotedName = $this->helper->quoteColumnName($field);
return new QueryFunction('LENGTH(' . $quotedName . ')' . $alias);
return new QueryFunction('CHAR_LENGTH(' . $quotedName . ')' . $alias);
} }


public function max($field): IQueryFunction { public function max($field): IQueryFunction {

+ 6
- 0
lib/private/DB/QueryBuilder/FunctionBuilder/OCIFunctionBuilder.php View File

$quotedName = $this->helper->quoteColumnName($field); $quotedName = $this->helper->quoteColumnName($field);
return new QueryFunction('LENGTHB(' . $quotedName . ')' . $alias); return new QueryFunction('LENGTHB(' . $quotedName . ')' . $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);
}
} }

+ 6
- 0
lib/private/DB/QueryBuilder/FunctionBuilder/SqliteFunctionBuilder.php View File

$quotedName = $this->helper->quoteColumnName($field); $quotedName = $this->helper->quoteColumnName($field);
return new QueryFunction('LENGTH(CAST(' . $quotedName . ' as BLOB))' . $alias); return new QueryFunction('LENGTH(CAST(' . $quotedName . ' as BLOB))' . $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);
}
} }

Loading…
Cancel
Save