Skip to content

Commit

Permalink
Update Grammar.php
Browse files Browse the repository at this point in the history
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+
laravel/framework#39863 (see changed files).
Just copied over old method, before PR merged.
  • Loading branch information
robsontenorio committed Feb 2, 2022
1 parent aa49f01 commit 1dead48
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Cache/Query/Grammars/Grammar.php
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)
);
}
}

0 comments on commit 1dead48

Please sign in to comment.