Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix LENGTH function name across databases
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc authored and mejo- committed Dec 14, 2022
commit 1578120133a9fae4d1e0f5fc4cd0f80f8cdc959c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function octetLength($field, $alias = ''): IQueryFunction {
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('CHAR_LENGTH(' . $quotedName . ')' . $alias);
}

public function max($field): IQueryFunction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,10 @@ public function octetLength($field, $alias = ''): IQueryFunction {
$quotedName = $this->helper->quoteColumnName($field);
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ public function octetLength($field, $alias = ''): IQueryFunction {
$quotedName = $this->helper->quoteColumnName($field);
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);
}
}