File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / pdo_firebird / tests / ddl.phpt
Revision 1.1.1.3 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:31:58 2013 UTC (11 years, 3 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--TEST--
PDO_Firebird: DDL/transactions
--SKIPIF--
<?php include("skipif.inc"); ?>
<?php function_exists("ibase_query") or die("skip"); ?>
--FILE--
<?php /* $Id: ddl.phpt,v 1.1.1.3 2013/07/22 01:31:58 misho Exp $ */

	require("testdb.inc");
    
	$db = new PDO("firebird:dbname=$test_base",$user,$password) or die;
	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
	
	$db->exec("CREATE TABLE ddl (id INT NOT NULL PRIMARY KEY, text BLOB SUB_TYPE 1)");
	$db->exec("CREATE GENERATOR gen_ddl_id");
	$db->exec("CREATE TRIGGER ddl_bi FOR ddl BEFORE INSERT AS
		BEGIN IF (NEW.id IS NULL) THEN NEW.id=GEN_ID(gen_ddl_id,1); END");
	
	$db->setAttribute(PDO::ATTR_AUTOCOMMIT,0);
	
	$db->beginTransaction();
	var_dump($db->exec("INSERT INTO ddl (text) VALUES ('bla')"));
	var_dump($db->exec("UPDATE ddl SET text='blabla'"));
	$db->rollback();
	
	$db->beginTransaction();
	var_dump($db->exec("DELETE FROM ddl"));
	$db->commit();
	
	unset($db);
	echo "done\n";
	
?>
--EXPECT--
int(1)
int(1)
int(0)
done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>