Skip to content

Commit

Permalink
Support Laravel 10
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Jan 18, 2023
1 parent 05a1d5c commit 0e82aec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
php: [8.2, 8.1, 8.0]
php: [8.2, 8.1]
database: [mysql, mariadb, pgsql, sqlite, sqlsrv]
release: [stable, lowest]
include:
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build:
environment:
php: 8.1
php: 8.2
tools:
external_code_coverage:
runs: 5
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
}
],
"require": {
"php": "^8.0.2",
"illuminate/database": "^9.0"
"php": "^8.1",
"illuminate/database": "^10.0"
},
"require-dev": {
"orchestra/testbench": "^7.0",
"nesbot/carbon": "^2.62.1"
"orchestra/testbench": "^8.0"
},
"autoload": {
"psr-4": {
Expand Down
18 changes: 3 additions & 15 deletions src/Query/Grammars/Traits/CompilesSqlServerExpressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,11 @@ trait CompilesSqlServerExpressions
*/
public function compileSelect(Builder $query)
{
if (!$query->offset) {
return $this->compileSelectParent($query);
if ($query->offset && empty($query->orders)) {
$query->orders[] = ['sql' => '(SELECT 0)'];
}

if (is_null($query->columns)) {
$query->columns = ['*'];
}

$expressions = $query->expressions;

$query->expressions = [];

$components = $this->compileComponents($query);

$query->expressions = $expressions;

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

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public function testDeleteWithLimit()

public function testOffsetSqlServer()
{
$expected = 'with [p] as (select * from [posts]) select * from (select *, row_number() over (order by (select 0)) as row_num from [users] inner join [p] on [p].[user_id] = [users].[id]) as temp_table where row_num >= 6 order by row_num';
$expected = 'with [p] as (select * from [posts]) select * from [users] inner join [p] on [p].[user_id] = [users].[id] order by (SELECT 0) offset 5 rows';

$query = $this->getBuilder('SqlServer')
->from('users')
Expand Down

0 comments on commit 0e82aec

Please sign in to comment.