xref: /PHP-8.3/ext/pdo_firebird/tests/execute.phpt (revision b5a14e6c)
1--TEST--
2PDO_Firebird: prepare/execute/binding
3--EXTENSIONS--
4pdo_firebird
5--SKIPIF--
6<?php require('skipif.inc'); ?>
7--ENV--
8LSAN_OPTIONS=detect_leaks=0
9--FILE--
10<?php
11    require("testdb.inc");
12
13    var_dump($dbh->getAttribute(PDO::ATTR_CONNECTION_STATUS));
14
15    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
16    $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S');
17
18    @$dbh->exec('DROP TABLE ddl');
19    $dbh->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32),
20        datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)");
21    $dbh->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')");
22
23    $s = $dbh->prepare("SELECT * FROM ddl WHERE id=? FOR UPDATE");
24
25    $id = 0;
26    $s->bindParam(1,$id);
27    $var = null;
28    $s->bindColumn("TEXT",$var);
29    $id = 1;
30    $s->execute();
31    $s->setAttribute(PDO::ATTR_CURSOR_NAME, "c");
32
33    var_dump($id);
34
35    var_dump($s->fetch());
36
37    var_dump($var);
38
39    var_dump($dbh->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c"));
40
41    var_dump($s->fetch());
42
43    unset($s);
44    unset($dbh);
45    echo "done\n";
46
47?>
48--EXPECT--
49bool(true)
50int(1)
51array(6) {
52  ["ID"]=>
53  int(1)
54  [0]=>
55  int(1)
56  ["TEXT"]=>
57  string(3) "bla"
58  [1]=>
59  string(3) "bla"
60  ["DATETIME"]=>
61  string(19) "2000-02-12 00:00:00"
62  [2]=>
63  string(19) "2000-02-12 00:00:00"
64}
65string(3) "bla"
66int(1)
67bool(false)
68done
69