diff --git a/lib/Db/SQLite3/Statement.php b/lib/Db/SQLite3/Statement.php index e0e5873..3f14df9 100644 --- a/lib/Db/SQLite3/Statement.php +++ b/lib/Db/SQLite3/Statement.php @@ -85,6 +85,6 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement { $a++; } } - return $a; + return $a - $offset; } } \ No newline at end of file diff --git a/tests/Db/SQLite3/TestDbStatementSQLite3.php b/tests/Db/SQLite3/TestDbStatementSQLite3.php index b436847..09a24e8 100644 --- a/tests/Db/SQLite3/TestDbStatementSQLite3.php +++ b/tests/Db/SQLite3/TestDbStatementSQLite3.php @@ -57,6 +57,19 @@ class TestDbStatementSQLite3 extends \PHPUnit\Framework\TestCase { $this->assertSame($exp, $val); } + function testBindRecursively() { + $exp = [ + 'one' => 1, + 'two' => 2, + 'three' => 3, + 'four' => 4, + ]; + $nativeStatement = $this->c->prepare("SELECT ? as one, ? as two, ? as three, ? as four"); + $s = new self::$imp($this->c, $nativeStatement, ["int", ["int", "int"], "int"]); + $val = $s->runArray([1, [2, 3], 4])->getRow(); + $this->assertSame($exp, $val); + } + function testBindWithoutType() { $nativeStatement = $this->c->prepare("SELECT ? as value"); $this->assertException("paramTypeMissing", "Db");