|
|
|
@ -153,16 +153,23 @@ class SimplePdoTest extends TestCase
|
|
|
|
$this->assertInstanceOf(Collection::class, $row);
|
|
|
|
$this->assertInstanceOf(Collection::class, $row);
|
|
|
|
$this->assertEquals(3, $row['id']); // Should be Bob (id=3)
|
|
|
|
$this->assertEquals(3, $row['id']); // Should be Bob (id=3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function testFetchRowDoesNotAddLimitAfterReturningClause(): void
|
|
|
|
public function testFetchRowDoesNotAddLimitAfterReturningClause(): void
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$row = $this->db->fetchRow(
|
|
|
|
try {
|
|
|
|
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
|
|
|
|
$row = $this->db->fetchRow(
|
|
|
|
['Alice', 'alice@example.com']
|
|
|
|
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
|
|
|
|
);
|
|
|
|
['Alice', 'alice@example.com']
|
|
|
|
|
|
|
|
);
|
|
|
|
$this->assertInstanceOf(Collection::class, $row);
|
|
|
|
|
|
|
|
$this->assertSame('Alice', $row['name']);
|
|
|
|
$this->assertInstanceOf(Collection::class, $row);
|
|
|
|
|
|
|
|
$this->assertSame('Alice', $row['name']);
|
|
|
|
|
|
|
|
} catch (PDOException $exception) {
|
|
|
|
|
|
|
|
$this->assertSame(
|
|
|
|
|
|
|
|
'Prepare failed: near "RETURNING": syntax error',
|
|
|
|
|
|
|
|
$exception->getMessage(),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// =========================================================================
|
|
|
|
// =========================================================================
|
|
|
|
|