Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept strings in AbstractPlatform::get*Expression() methods #5129

Merged
merged 1 commit into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 8 additions & 8 deletions src/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ public function getSqrtExpression($column)
*
* @deprecated Use ROUND() in SQL instead.
*
* @param string $column
* @param int $decimals
* @param string $column
* @param string|int $decimals
*
* @return string
*/
Expand Down Expand Up @@ -975,9 +975,9 @@ public function getLowerExpression($str)
/**
* Returns the SQL snippet to get the position of the first occurrence of substring $substr in string $str.
*
* @param string $str Literal string.
* @param string $substr Literal string to find.
* @param int|false $startPos Position to start at, beginning of string by default.
* @param string $str Literal string.
* @param string $substr Literal string to find.
* @param string|int|false $startPos Position to start at, beginning of string by default.
*
* @return string
*
Expand Down Expand Up @@ -1013,9 +1013,9 @@ public function getNowExpression()
*
* SQLite only supports the 2 parameter variant of this function.
*
* @param string $string An sql string literal or column name/alias.
* @param int $start Where to start the substring portion.
* @param int|null $length The substring portion length.
* @param string $string An sql string literal or column name/alias.
* @param string|int $start Where to start the substring portion.
* @param string|int|null $length The substring portion length.
*
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Platforms/PostgreSQLPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function getLocateExpression($str, $substr, $startPos = false)
$str = $this->getSubstringExpression($str, $startPos);

return 'CASE WHEN (POSITION(' . $substr . ' IN ' . $str . ') = 0) THEN 0'
. ' ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . ($startPos - 1) . ') END';
. ' ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . $startPos . ' - 1) END';
}

return 'POSITION(' . $substr . ' IN ' . $str . ')';
Expand Down