public function getSubstringExpression($value, $position, $length = null) { if ($length !== null) { return "SUBSTR({$value}, {$position}, {$length})"; } return "SUBSTR({$value}, {$position})"; }