1--TEST--
2mysqli_stmt_get_result() - meta data, field_count()
3--SKIPIF--
4<?php
5	require_once('skipif.inc');
6	require_once('skipifemb.inc');
7	require_once('skipifconnectfailure.inc');
8
9	if (!function_exists('mysqli_stmt_get_result'))
10		die('skip mysqli_stmt_get_result not available');
11?>
12--FILE--
13<?php
14	require('table.inc');
15
16	if (!$stmt = mysqli_stmt_init($link))
17		printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
18
19	if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id ASC LIMIT 3"))
20		printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
21
22	if (!mysqli_stmt_execute($stmt))
23		printf("[003] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
24
25	if (!is_object($res = mysqli_stmt_get_result($stmt)) || 'mysqli_result' != get_class($res)) {
26		printf("[004] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
27			gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
28	}
29
30	if (!is_object($res_meta = mysqli_stmt_result_metadata($stmt)) ||
31		'mysqli_result' != get_class($res_meta)) {
32		printf("[005] Expecting object/mysqli_result got %s/%s, [%d] %s\n",
33			gettype($res), $res, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
34	}
35
36	printf("%s %s\n",
37	$res_meta->field_count,
38	$res->field_count);
39
40	mysqli_stmt_close($stmt);
41	mysqli_close($link);
42	print "done!";
43?>
44--CLEAN--
45<?php
46	require_once("clean_table.inc");
47?>
48--EXPECTF--
492 2
50done!