xref: /PHP-7.1/ext/mysqli/tests/045.phpt (revision 113213f0)
1--TEST--
2mysqli_stmt_bind_result (SHOW)
3--SKIPIF--
4<?php
5	require_once('skipif.inc');
6	require_once('skipifemb.inc');
7	require_once('skipifconnectfailure.inc');
8
9	require_once("connect.inc");
10	$link = my_mysqli_connect($host, $user, $passwd);
11
12	$stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
13	mysqli_stmt_execute($stmt);
14
15	if (!$stmt->field_count) {
16		printf("skip SHOW command is not supported in prepared statements.");
17	}
18	$stmt->close();
19	mysqli_close($link);
20?>
21--FILE--
22<?php
23	require_once("connect.inc");
24
25	/*** test mysqli_connect 127.0.0.1 ***/
26	$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
27
28	$stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
29	mysqli_stmt_execute($stmt);
30
31	mysqli_stmt_bind_result($stmt, $c1, $c2);
32	mysqli_stmt_fetch($stmt);
33	mysqli_stmt_close($stmt);
34	if ((version_compare(PHP_VERSION, '6.0', '==') == 1) && mysqli_get_server_version($link) < 50000) {
35		/* variables are binary */
36		settype($c1, "unicode");
37		settype($c2, "unicode");
38	}
39	$test = array ($c1,$c2);
40
41	var_dump($test);
42
43	mysqli_close($link);
44	print "done!";
45?>
46--EXPECTF--
47array(2) {
48  [0]=>
49  %unicode|string%(4) "port"
50  [1]=>
51  %unicode|string%(%d) "%s"
52}
53done!
54