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