Skip to content

Commit bcd25bd

Browse files
committed
Merge branch '10.x'
# Conflicts: # .github/workflows/databases.yml
2 parents ea37a52 + 93bbdaa commit bcd25bd

File tree

4 files changed

+48
-80
lines changed

4 files changed

+48
-80
lines changed

.github/workflows/databases.yml

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -181,46 +181,46 @@ jobs:
181181
DB_CONNECTION: pgsql
182182
DB_PASSWORD: password
183183

184-
mssql:
185-
runs-on: ubuntu-20.04
186-
187-
services:
188-
sqlsrv:
189-
image: mcr.microsoft.com/mssql/server:2019-latest
190-
env:
191-
ACCEPT_EULA: Y
192-
SA_PASSWORD: Forge123
193-
ports:
194-
- 1433:1433
195-
196-
strategy:
197-
fail-fast: true
198-
199-
name: SQL Server 2019
200-
201-
steps:
202-
- name: Checkout code
203-
uses: actions/checkout@v3
204-
205-
- name: Setup PHP
206-
uses: shivammathur/setup-php@v2
207-
with:
208-
php-version: 8.2
209-
extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc
210-
tools: composer:v2
211-
coverage: none
212-
213-
- name: Install dependencies
214-
uses: nick-fields/retry@v2
215-
with:
216-
timeout_minutes: 5
217-
max_attempts: 5
218-
command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
219-
220-
- name: Execute tests
221-
run: vendor/bin/phpunit tests/Integration/Database
222-
env:
223-
DB_CONNECTION: sqlsrv
224-
DB_DATABASE: master
225-
DB_USERNAME: SA
226-
DB_PASSWORD: Forge123
184+
# mssql:
185+
# runs-on: ubuntu-20.04
186+
187+
# services:
188+
# sqlsrv:
189+
# image: mcr.microsoft.com/mssql/server:2019-latest
190+
# env:
191+
# ACCEPT_EULA: Y
192+
# SA_PASSWORD: Forge123
193+
# ports:
194+
# - 1433:1433
195+
196+
# strategy:
197+
# fail-fast: true
198+
199+
# name: SQL Server 2019
200+
201+
# steps:
202+
# - name: Checkout code
203+
# uses: actions/checkout@v3
204+
205+
# - name: Setup PHP
206+
# uses: shivammathur/setup-php@v2
207+
# with:
208+
# php-version: 8.2
209+
# extensions: dom, curl, libxml, mbstring, zip, pcntl, sqlsrv, pdo, pdo_sqlsrv, odbc, pdo_odbc
210+
# tools: composer:v2
211+
# coverage: none
212+
213+
# - name: Install dependencies
214+
# uses: nick-fields/retry@v2
215+
# with:
216+
# timeout_minutes: 5
217+
# max_attempts: 5
218+
# command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress
219+
220+
# - name: Execute tests
221+
# run: vendor/bin/phpunit tests/Integration/Database
222+
# env:
223+
# DB_CONNECTION: sqlsrv
224+
# DB_DATABASE: master
225+
# DB_USERNAME: SA
226+
# DB_PASSWORD: Forge123

src/Illuminate/Auth/Access/Gate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Gate implements GateContract
7171
/**
7272
* The default denial response for gates and policies.
7373
*
74-
* @var Illuminate\Auth\Access\Response|null
74+
* @var \Illuminate\Auth\Access\Response|null
7575
*/
7676
protected $defaultDenialResponse;
7777

src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SqlServerGrammar extends Grammar
4848
public function compileSelect(Builder $query)
4949
{
5050
// An order by clause is required for SQL Server offset to function...
51-
if ($query->offset && empty($query->orders)) {
51+
if (($query->offset || $query->limit) && empty($query->orders)) {
5252
$query->orders[] = ['sql' => '(SELECT 0)'];
5353
}
5454

@@ -266,38 +266,6 @@ protected function compileHavingBitwise($having)
266266
return '('.$column.' '.$having['operator'].' '.$parameter.') != 0';
267267
}
268268

269-
/**
270-
* Move the order bindings to be after the "select" statement to account for an order by subquery.
271-
*
272-
* @param \Illuminate\Database\Query\Builder $query
273-
* @return array
274-
*/
275-
protected function sortBindingsForSubqueryOrderBy($query)
276-
{
277-
return Arr::sort($query->bindings, function ($bindings, $key) {
278-
return array_search($key, ['select', 'order', 'from', 'join', 'where', 'groupBy', 'having', 'union', 'unionOrder']);
279-
});
280-
}
281-
282-
/**
283-
* Compile the limit / offset row constraint for a query.
284-
*
285-
* @param \Illuminate\Database\Query\Builder $query
286-
* @return string
287-
*/
288-
protected function compileRowConstraint($query)
289-
{
290-
$start = (int) $query->offset + 1;
291-
292-
if ($query->limit > 0) {
293-
$finish = (int) $query->offset + (int) $query->limit;
294-
295-
return "between {$start} and {$finish}";
296-
}
297-
298-
return ">= {$start}";
299-
}
300-
301269
/**
302270
* Compile a delete statement without joins into SQL.
303271
*

tests/Database/DatabaseQueryBuilderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ public function testAggregateFunctions()
26902690
public function testSqlServerExists()
26912691
{
26922692
$builder = $this->getSqlServerBuilder();
2693-
$builder->getConnection()->shouldReceive('select')->once()->with('select top 1 1 [exists] from [users]', [], true)->andReturn([['exists' => 1]]);
2693+
$builder->getConnection()->shouldReceive('select')->once()->with('select top 1 1 [exists] from [users] order by (SELECT 0)', [], true)->andReturn([['exists' => 1]]);
26942694
$results = $builder->from('users')->exists();
26952695
$this->assertTrue($results);
26962696
}
@@ -3856,7 +3856,7 @@ public function testSqlServerLimitsAndOffsets()
38563856
{
38573857
$builder = $this->getSqlServerBuilder();
38583858
$builder->select('*')->from('users')->take(10);
3859-
$this->assertSame('select top 10 * from [users]', $builder->toSql());
3859+
$this->assertSame('select top 10 * from [users] order by (SELECT 0)', $builder->toSql());
38603860

38613861
$builder = $this->getSqlServerBuilder();
38623862
$builder->select('*')->from('users')->skip(10)->orderBy('email', 'desc');
@@ -3875,7 +3875,7 @@ public function testSqlServerLimitsAndOffsets()
38753875
return $query->select('created_at')->from('logins')->where('users.name', 'nameBinding')->whereColumn('user_id', 'users.id')->limit(1);
38763876
};
38773877
$builder->select('*')->from('users')->where('email', 'emailBinding')->orderBy($subQuery)->skip(10)->take(10);
3878-
$this->assertSame('select * from [users] where [email] = ? order by (select top 1 [created_at] from [logins] where [users].[name] = ? and [user_id] = [users].[id]) asc offset 10 rows fetch next 10 rows only', $builder->toSql());
3878+
$this->assertSame('select * from [users] where [email] = ? order by (select top 1 [created_at] from [logins] where [users].[name] = ? and [user_id] = [users].[id] order by (SELECT 0)) asc offset 10 rows fetch next 10 rows only', $builder->toSql());
38793879
$this->assertEquals(['emailBinding', 'nameBinding'], $builder->getBindings());
38803880

38813881
$builder = $this->getSqlServerBuilder();

0 commit comments

Comments
 (0)