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