mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Added test for recursive binding
Also fixed a bug uncovered by the test
This commit is contained in:
parent
818707b067
commit
b02abec250
2 changed files with 14 additions and 1 deletions
|
@ -85,6 +85,6 @@ class Statement extends \JKingWeb\Arsse\Db\AbstractStatement {
|
|||
$a++;
|
||||
}
|
||||
}
|
||||
return $a;
|
||||
return $a - $offset;
|
||||
}
|
||||
}
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue