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 committed Dec 19, 2022
commit 6185e326dca7e825231041d9be434a3bc09c1031
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);
}
}