1--TEST-- 2mysqli_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_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 /* overrule autocommit */ 38 if (true !== ($tmp = mysqli_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_rollback($link); 45 if ($tmp !== true) 46 printf("[012] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); 47 48 print "done!"; 49?> 50--CLEAN-- 51<?php 52require_once "clean_table.inc"; 53?> 54--EXPECT-- 55mysqli_savepoint(): Argument #2 ($name) cannot be empty 56done! 57