1--TEST--
2PDO_firebird connect through PDO::connect
3--EXTENSIONS--
4pdo_firebird
5--SKIPIF--
6<?php require(__DIR__ . '/skipif.inc'); ?>
7--XLEAK--
8A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9See https://github.com/FirebirdSQL/firebird/issues/7849
10--FILE--
11<?php
12
13require_once __DIR__ . "/testdb.inc";
14
15$db = connectToDb();
16if (!$db instanceof Pdo\Firebird) {
17    echo "Wrong class type. Should be Pdo\Firebird but is " . get_class($db) . "\n";
18}
19
20$db->query('CREATE TABLE pdofirebird_002 (idx INT NOT NULL PRIMARY KEY, name VARCHAR(20))');
21
22$db->exec("INSERT INTO pdofirebird_002 VALUES(1, 'A')");
23$db->exec("INSERT INTO pdofirebird_002 VALUES(2, 'B')");
24$db->exec("INSERT INTO pdofirebird_002 VALUES(3, 'C')");
25
26foreach ($db->query('SELECT name FROM pdofirebird_002') as $row) {
27    var_dump($row);
28}
29
30echo "Fin.";
31?>
32--CLEAN--
33<?php
34require_once __DIR__ . "/testdb.inc";
35$dbh = getDbConnection();
36@$dbh->exec("DROP TABLE pdofirebird_002");
37unset($dbh);
38?>
39--EXPECT--
40array(2) {
41  ["NAME"]=>
42  string(1) "A"
43  [0]=>
44  string(1) "A"
45}
46array(2) {
47  ["NAME"]=>
48  string(1) "B"
49  [0]=>
50  string(1) "B"
51}
52array(2) {
53  ["NAME"]=>
54  string(1) "C"
55  [0]=>
56  string(1) "C"
57}
58Fin.
59