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