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

Backport compileSelect #1

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Cache/Query/Grammars/Grammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,32 @@ protected function compileTableExpression($sql, $query)

return "select *, %vid from ({$sql}) where %vid {$constraint}";
}


/**
* This is a compatible method that usually worked with old version of SqlServerGramar.
*
* This PR introduced a braking change, once Laravel now supports only SQLServer 2017+
* https://github.com/laravel/framework/pull/39863 (see changed files)
*
* Just copied over old method, before Laravel PR got merged.
*
*/
public function compileSelect(Builder $query)
{
if (! $query->offset) {
return parent::compileSelect($query);
}

// If an offset is present on the query, we will need to wrap the query in
// a big "ANSI" offset syntax block. This is very nasty compared to the
// other database systems but is necessary for implementing features.
if (is_null($query->columns)) {
$query->columns = ['*'];
}

return $this->compileAnsiOffset(
$query, $this->compileComponents($query)
);
}
}