xref: /PHP-7.3/ext/pdo_firebird/tests/execute.phpt (revision 782352c5)
1--TEST--
2PDO_Firebird: prepare/execute/binding
3--SKIPIF--
4<?php include("skipif.inc"); ?>
5<?php function_exists("ibase_query") or die("skip"); ?>
6--INI--
7ibase.timestampformat=%Y-%m-%d %H:%M:%S
8--FILE--
9<?php
10
11	require("testdb.inc");
12
13	$db = new PDO("firebird:dbname=$test_base",$user,$password) or die;
14
15	var_dump($db->getAttribute(PDO::ATTR_CONNECTION_STATUS));
16
17	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
18
19	$db->exec("CREATE TABLE ddl (id SMALLINT NOT NULL PRIMARY KEY, text VARCHAR(32),
20		datetime TIMESTAMP DEFAULT '2000-02-12' NOT NULL)");
21	$db->exec("INSERT INTO ddl (id,text) VALUES (1,'bla')");
22
23	$s = $db->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($db->exec("UPDATE ddl SET id=2 WHERE CURRENT OF c"));
40
41	var_dump($s->fetch());
42
43	unset($s);
44	unset($db);
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