xref: /PHP-5.3/ext/pdo_firebird/tests/ddl.phpt (revision 16483720)
1--TEST--
2PDO_Firebird: DDL/transactions
3--SKIPIF--
4<?php include("skipif.inc"); ?>
5--FILE--
6<?php /* $Id$ */
7
8	require("testdb.inc");
9
10	$db = new PDO("firebird:dbname=$test_base",$user,$password) or die;
11	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
12
13	$db->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)");
14	$db->exec("CREATE GENERATOR gen_ddl_id");
15	$db->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS
16		BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END");
17
18	$db->setAttribute(PDO::ATTR_AUTOCOMMIT,0);
19
20	$db->beginTransaction();
21	var_dump($db->exec("INSERT INTO ddl (text) VALUES ('bla')"));
22	var_dump($db->exec("UPDATE ddl SET text='blabla'"));
23	$db->rollback();
24
25	$db->beginTransaction();
26	var_dump($db->exec("DELETE FROM ddl"));
27	$db->commit();
28
29	unset($db);
30	echo "done\n";
31
32?>
33--EXPECT--
34int(1)
35int(1)
36int(0)
37done
38