1--TEST-- 2mysqli autocommit/commit/rollback with innodb with SQL_NO_CACHE 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 8mysqli_check_innodb_support_skip_test(); 9?> 10--FILE-- 11<?php 12require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 13 14 $link = default_mysqli_connect(); 15 16 mysqli_autocommit($link, true); 17 mysqli_query($link,"CREATE TABLE test_transactions_15(a int, b varchar(10)) Engine=InnoDB"); 18 mysqli_query($link, "INSERT INTO test_transactions_15 VALUES (1, 'foobar')"); 19 mysqli_autocommit($link, false); 20 21 /* Modify data in DB */ 22 mysqli_query($link, "DELETE FROM test_transactions_15"); 23 mysqli_query($link, "INSERT INTO test_transactions_15 VALUES (2, 'egon')"); 24 25 /* Attempt to rollback */ 26 mysqli_rollback($link); 27 28 /* Check if rollback was successful */ 29 $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM test_transactions_15"); 30 $row = mysqli_fetch_row($result); 31 mysqli_free_result($result); 32 var_dump($row); 33 34 /* Modify data in DB */ 35 mysqli_query($link, "DELETE FROM test_transactions_15"); 36 mysqli_query($link, "INSERT INTO test_transactions_15 VALUES (2, 'egon')"); 37 38 /* Commit modifications */ 39 mysqli_commit($link); 40 41 /* Check if commit was successful */ 42 $result = mysqli_query($link, "SELECT * FROM test_transactions_15"); 43 $row = mysqli_fetch_row($result); 44 mysqli_free_result($result); 45 46 var_dump($row); 47 48 mysqli_close($link); 49 print "done!"; 50?> 51--CLEAN-- 52<?php 53require_once dirname(__DIR__) . "/test_setup/test_helpers.inc"; 54tear_down_table_on_default_connection('test_transactions_15'); 55?> 56--EXPECT-- 57array(2) { 58 [0]=> 59 string(1) "1" 60 [1]=> 61 string(6) "foobar" 62} 63array(2) { 64 [0]=> 65 string(1) "2" 66 [1]=> 67 string(4) "egon" 68} 69done! 70