Annotation of embedaddon/php/ext/pdo_oci/tests/pdo_oci_attr_autocommit_3.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
1.1.1.2 ! misho 2: PDO_OCI: Attribute: closing a connection in non-autocommit mode commits data
1.1 misho 3: --SKIPIF--
4: <?php
5: if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
6: require(dirname(__FILE__).'/../../pdo/tests/pdo_test.inc');
7: PDOTest::skip();
8: ?>
9: --FILE--
10: <?php
11:
12: require(dirname(__FILE__) . '/../../pdo/tests/pdo_test.inc');
13:
14: // Check connection can be created with AUTOCOMMIT off
15: putenv('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:
23: print "PDO::ATTR_AUTOCOMMIT: ";
24: var_dump($dbh->getAttribute(PDO::ATTR_AUTOCOMMIT));
25:
26: echo "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:
34: echo "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();
38: while ($r = $s->fetch()) {
39: echo "Data is: " . $r[0] . "\n";
40: }
41:
42: $dbh2->exec("drop table pdo_ac_tab");
43:
44: echo "Done\n";
45:
46: ?>
47: --EXPECTF--
48: PDO::ATTR_AUTOCOMMIT: bool(false)
49: Insert data
50: Second connection should be able to see committed data
51: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>