1--TEST-- 2mysqli_info() 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--INI-- 10mysqli.allow_local_infile=1 11--FILE-- 12<?php 13 require_once("connect.inc"); 14 15 require "table.inc"; 16 if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')")) 17 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 18 19 // NOTE: empty string, no multiple insert syntax 20 if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) 21 printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp); 22 23 if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')")) 24 printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 25 26 if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) 27 printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); 28 29 if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test')) 30 printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 31 32 if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) 33 printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); 34 35 if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)')) 36 printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 37 38 if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) 39 printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); 40 41 if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100")) 42 printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 43 44 if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) 45 printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); 46 47 if (!$res = mysqli_query($link, "SELECT 1")) 48 printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 49 50 if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp)) 51 printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp); 52 mysqli_free_result($res); 53 54 // NOTE: no LOAD DATA INFILE test 55 if ($dir = sys_get_temp_dir()) { 56 do { 57 $file = $dir . '/' . 'mysqli_info_phpt.cvs'; 58 if (!$fp = fopen($file, 'w')) 59 /* ignore this error */ 60 break; 61 62 if (!fwrite($fp, "100;'a';\n") || 63 !fwrite($fp, "101;'b';\n") || 64 !fwrite($fp, "102;'c';\n")) { 65 @unlink($file); 66 break; 67 } 68 fclose($fp); 69 if (!mysqli_query($link, "DELETE FROM test")) { 70 printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 71 break; 72 } 73 74 if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) { 75 /* ok, because we might not be allowed to do this */ 76 @unlink($file); 77 break; 78 } 79 80 if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp)) 81 printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); 82 83 unlink($file); 84 } while (false); 85 } 86 87 print "done!"; 88?> 89--CLEAN-- 90<?php 91 require_once("clean_table.inc"); 92?> 93--EXPECT-- 94done! 95