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