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