1--TEST-- 2mysqli_stmt_sqlstate() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--FILE-- 10<?php 11 require_once("connect.inc"); 12 13 require('table.inc'); 14 15 if (!$stmt = mysqli_stmt_init($link)) 16 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 17 18 try { 19 mysqli_stmt_sqlstate($stmt); 20 } catch (Error $exception) { 21 echo $exception->getMessage() . "\n"; 22 } 23 24 if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test")) 25 printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); 26 27 if ('00000' !== ($tmp = mysqli_stmt_sqlstate($stmt))) 28 printf("[007] Expecting string/00000, got %s/%s. [%d] %s\n", 29 gettype($tmp), $tmp, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); 30 31 if (mysqli_stmt_prepare($stmt, "SELECT believe_me FROM i_dont_belive_that_this_table_exists")) 32 printf("[008] Should fail! [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); 33 34 if ('' === ($tmp = mysqli_stmt_sqlstate($stmt))) 35 printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); 36 37 mysqli_stmt_close($stmt); 38 39 try { 40 mysqli_stmt_sqlstate($stmt); 41 } catch (Error $exception) { 42 echo $exception->getMessage() . "\n"; 43 } 44 45 mysqli_close($link); 46 print "done!"; 47?> 48--CLEAN-- 49<?php 50 require_once("clean_table.inc"); 51?> 52--EXPECT-- 53mysqli_stmt object is not fully initialized 54mysqli_stmt object is already closed 55done! 56