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