]> source.dussan.org Git - nextcloud-server.git/commitdiff
Apply changes from master's update to 3.1.3 29718/head
authorJoas Schilling <coding@schilljs.com>
Mon, 15 Nov 2021 18:06:36 +0000 (19:06 +0100)
committerJoas Schilling <coding@schilljs.com>
Mon, 15 Nov 2021 18:07:11 +0000 (19:07 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/DB/QueryBuilder/QueryBuilder.php
lib/private/Repair/SqliteAutoincrement.php
lib/public/DB/QueryBuilder/IQueryBuilder.php
tests/lib/DB/QueryBuilder/QueryBuilderTest.php

index 0a9590aa3d9899a358b9249d39cc89377967780c..b235745f47b83f0760e2c1453b152b205d2ffe0e 100644 (file)
@@ -410,9 +410,9 @@ class QueryBuilder implements IQueryBuilder {
 
        /**
         * Gets the position of the first result the query object was set to retrieve (the "offset").
-        * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
+        * Returns 0 if {@link setFirstResult} was not applied to this QueryBuilder.
         *
-        * @return integer The position of the first result.
+        * @return int The position of the first result.
         */
        public function getFirstResult() {
                return $this->queryBuilder->getFirstResult();
index 651a3c144f34027c5a8bca4b3707e0baaaf587da..a49a3f45348d9ff59a88999d9819c5e9833d7e0b 100644 (file)
@@ -84,7 +84,7 @@ class SqliteAutoincrement implements IRepairStep {
                                foreach ($columnNames as $columnName) {
                                        $columnSchema = $tableSchema->getColumn($columnName);
                                        $columnDiff = new ColumnDiff($columnSchema->getName(), $columnSchema);
-                                       $tableDiff->changedColumns[] = $columnDiff;
+                                       $tableDiff->changedColumns[$columnSchema->getName()] = $columnDiff;
                                        $schemaDiff->changedTables[] = $tableDiff;
                                }
                        } catch (SchemaException $e) {
index fcba00b92b38f087055ad59ba5c89cdfd34ca583..702216e0309424ff2def009629b77f65b344066d 100644 (file)
@@ -265,9 +265,9 @@ interface IQueryBuilder {
 
        /**
         * Gets the position of the first result the query object was set to retrieve (the "offset").
-        * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
+        * Returns 0 if {@link setFirstResult} was not applied to this QueryBuilder.
         *
-        * @return integer The position of the first result.
+        * @return int The position of the first result.
         * @since 8.2.0
         */
        public function getFirstResult();
index aef1acc40c1d9c8c1e28170078bb6f7ceaf86465..1927850470743cd581dbabceea99b95e0f4b1048 100644 (file)
@@ -102,7 +102,7 @@ class QueryBuilderTest extends \Test\TestCase {
 
        public function dataFirstResult() {
                return [
-                       [null, [99, 98, 97, 96, 95, 94, 93, 92, 91]],
+                       [0, [99, 98, 97, 96, 95, 94, 93, 92, 91]],
                        [0, [99, 98, 97, 96, 95, 94, 93, 92, 91]],
                        [1, [98, 97, 96, 95, 94, 93, 92, 91]],
                        [5, [94, 93, 92, 91]],
@@ -112,7 +112,7 @@ class QueryBuilderTest extends \Test\TestCase {
        /**
         * @dataProvider dataFirstResult
         *
-        * @param int $firstResult
+        * @param int|null $firstResult
         * @param array $expectedSet
         */
        public function testFirstResult($firstResult, $expectedSet) {
@@ -121,14 +121,10 @@ class QueryBuilderTest extends \Test\TestCase {
 
                if ($firstResult !== null) {
                        $this->queryBuilder->setFirstResult($firstResult);
-
-                       // FIXME Remove this once Doctrine/DBAL is >2.5.1:
-                       // FIXME See https://github.com/doctrine/dbal/pull/782
-                       $this->queryBuilder->setMaxResults(100);
                }
 
                $this->assertSame(
-                       $firstResult,
+                       $firstResult ?? 0,
                        $this->queryBuilder->getFirstResult()
                );