1--TEST-- 2PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data 3--SKIPIF-- 4<?php 5if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded'); 6require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc'); 7PDOTest::skip(); 8?> 9--FILE-- 10<?php 11 12require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc'); 13 14// Check connection can be created with AUTOCOMMIT off 15putenv('PDOTEST_ATTR='.serialize(array(PDO::ATTR_AUTOCOMMIT=>false))); 16$dbh = PDOTest::factory(); 17 18$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); 19$dbh->exec("drop table pdo_ac_tab"); 20 21$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 22 23print "PDO::ATTR_AUTOCOMMIT: "; 24var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT)); 25 26echo "Insert data\n"; 27 28$dbh->exec("create table pdo_ac_tab (col1 varchar2(20))"); 29 30$dbh->exec("insert into pdo_ac_tab (col1) values ('some data')"); 31 32$dbh = null; // close first connection 33 34echo "Second connection should be able to see committed data\n"; 35$dbh2 = PDOTest::factory(); 36$s = $dbh2->prepare("select col1 from pdo_ac_tab"); 37$s->execute(); 38while ($r = $s->fetch()) { 39 echo "Data is: " . $r[0] . "\n"; 40} 41 42$dbh2->exec("drop table pdo_ac_tab"); 43 44echo "Done\n"; 45 46?> 47--EXPECT-- 48PDO::ATTR_AUTOCOMMIT: bool(false) 49Insert data 50Second connection should be able to see committed data 51Done 52