File: pdofirebird_002.phpt

package info (click to toggle)
php8.4 8.4.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 208,108 kB
  • sloc: ansic: 1,060,628; php: 35,345; sh: 11,866; cpp: 7,201; pascal: 4,913; javascript: 3,091; asm: 2,810; yacc: 2,411; makefile: 689; xml: 446; python: 301; awk: 148
file content (58 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--TEST--
PDO_firebird connect through PDO::connect
--EXTENSIONS--
pdo_firebird
--SKIPIF--
<?php require(__DIR__ . '/skipif.inc'); ?>
--XLEAK--
A bug in firebird causes a memory leak when calling `isc_attach_database()`.
See https://github.com/FirebirdSQL/firebird/issues/7849
--FILE--
<?php

require_once __DIR__ . "/testdb.inc";

$db = connectToDb();
if (!$db instanceof Pdo\Firebird) {
    echo "Wrong class type. Should be Pdo\Firebird but is " . get_class($db) . "\n";
}

$db->query('CREATE TABLE pdofirebird_002 (idx INT NOT NULL PRIMARY KEY, name VARCHAR(20))');

$db->exec("INSERT INTO pdofirebird_002 VALUES(1, 'A')");
$db->exec("INSERT INTO pdofirebird_002 VALUES(2, 'B')");
$db->exec("INSERT INTO pdofirebird_002 VALUES(3, 'C')");

foreach ($db->query('SELECT name FROM pdofirebird_002') as $row) {
    var_dump($row);
}

echo "Fin.";
?>
--CLEAN--
<?php
require_once __DIR__ . "/testdb.inc";
$dbh = getDbConnection();
@$dbh->exec("DROP TABLE pdofirebird_002");
unset($dbh);
?>
--EXPECT--
array(2) {
  ["NAME"]=>
  string(1) "A"
  [0]=>
  string(1) "A"
}
array(2) {
  ["NAME"]=>
  string(1) "B"
  [0]=>
  string(1) "B"
}
array(2) {
  ["NAME"]=>
  string(1) "C"
  [0]=>
  string(1) "C"
}
Fin.