xref: /php-src/ext/pdo_dblib/tests/bug_38955.phpt (revision d6a0b3af)
1--TEST--
2 PDO_DBLIB driver does not support transactions
3--EXTENSIONS--
4pdo_dblib
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8getDbConnection();
9?>
10--FILE--
11<?php
12require __DIR__ . '/config.inc';
13
14$db = getDbConnection();
15
16/*We see these rows */
17$db->query("CREATE table test38955(val int)");
18$db->beginTransaction();
19$db->query("INSERT INTO test38955(val) values(1)");
20$db->query("INSERT INTO test38955(val) values(2)");
21$db->query("INSERT INTO test38955(val) values(3)");
22$db->query("INSERT INTO test38955(val) values(4)");
23$db->commit();
24
25/*We don't see these rows */
26$db->beginTransaction();
27$db->query("INSERT INTO test38955(val) values(5)");
28$db->query("INSERT INTO test38955(val) values(6)");
29$db->query("INSERT INTO test38955(val) values(7)");
30$db->query("INSERT INTO test38955(val) values(8)");
31$db->rollback();
32
33$rs = $db->query("SELECT * FROM test38955");
34$rows = $rs->fetchAll(PDO::FETCH_ASSOC);
35var_dump($rows);
36?>
37--CLEAN--
38<?php
39require __DIR__ . '/config.inc';
40$db = getDbConnection();
41$db->exec("DROP TABLE IF EXISTS test38955");
42?>
43--EXPECT--
44array(4) {
45  [0]=>
46  array(1) {
47    ["val"]=>
48    int(1)
49  }
50  [1]=>
51  array(1) {
52    ["val"]=>
53    int(2)
54  }
55  [2]=>
56  array(1) {
57    ["val"]=>
58    int(3)
59  }
60  [3]=>
61  array(1) {
62    ["val"]=>
63    int(4)
64  }
65}
66