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