1--TEST-- 2mysqli_release_savepoint() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7 8require_once('connect.inc'); 9if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 10 die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); 11 12if (!have_innodb($link)) 13 die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error)); 14?> 15--FILE-- 16<?php 17 require_once("connect.inc"); 18 $tmp = NULL; 19 $link = NULL; 20 21 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 22 printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 23 $host, $user, $db, $port, $socket); 24 25 try { 26 mysqli_release_savepoint($link, ''); 27 } catch (\ValueError $e) { 28 echo $e->getMessage() . \PHP_EOL; 29 } 30 31 if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) 32 printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 33 34 if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) 35 printf("[008] Cannot create test table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 36 37 if (true !== ($tmp = mysqli_autocommit($link, false))) 38 printf("[009] Cannot turn off autocommit, expecting true, got %s/%s\n", gettype($tmp), $tmp); 39 40 /* note that there is no savepoint my... */ 41 if (false !== ($tmp = mysqli_release_savepoint($link, 'my'))) 42 printf("[010] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); 43 44 if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)')) 45 printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 46 47 $tmp = mysqli_commit($link); 48 if ($tmp !== true) 49 printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); 50 51 if (true !== ($tmp = mysqli_savepoint($link, 'my'))) 52 printf("[013] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); 53 54 $res = mysqli_query($link, "SELECT * FROM test"); 55 var_dump($res->fetch_assoc()); 56 57 if (true !== ($tmp = mysqli_release_savepoint($link, 'my'))) 58 printf("[014] Got %s - [%d] %s\n", var_dump($tmp, true), mysqli_errno($link), mysqli_error($link)); 59 60 print "done!"; 61?> 62--CLEAN-- 63<?php 64 require_once("clean_table.inc"); 65?> 66--EXPECT-- 67mysqli_release_savepoint(): Argument #2 ($name) cannot be empty 68array(1) { 69 ["id"]=> 70 string(1) "1" 71} 72done! 73