1--TEST--
2mysqli_stmt_fetch_fields() unicode, win32
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11    require_once('table.inc');
12
13    $bind_res = $id = null;
14    if (!($stmt = mysqli_stmt_init($link)) ||
15        !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
16        !mysqli_stmt_execute($stmt) ||
17        !($result = mysqli_stmt_result_metadata($stmt)) ||
18        !mysqli_stmt_bind_result($stmt, $id, $bind_res) ||
19        !($fields = mysqli_fetch_fields($result))) {
20        printf("FAIL 1\n");
21    }
22    while (mysqli_stmt_fetch($stmt)) {
23        ;
24    }
25    mysqli_free_result($result);
26    mysqli_stmt_close($stmt);
27
28    if (!($stmt = mysqli_stmt_init($link)) ||
29        !mysqli_stmt_prepare($stmt, "SELECT id, label FROM test") ||
30        !mysqli_stmt_execute($stmt) ||
31        !($result = mysqli_stmt_result_metadata($stmt)) ||
32        !mysqli_stmt_bind_result($stmt, $id, $bind_res)) {
33        printf("FAIL 2\n");
34    }
35    print "OK: 1\n";
36    if (!($fields = mysqli_fetch_fields($result)))
37        printf("Aua 3\n");
38    print "OK: 2\n";
39    while (mysqli_stmt_fetch($stmt)) {
40        ;
41    }
42    mysqli_free_result($result);
43    mysqli_stmt_close($stmt);
44
45    mysqli_close($link);
46    print "done!";
47?>
48--CLEAN--
49<?php
50    require_once("clean_table.inc");
51?>
52--EXPECT--
53OK: 1
54OK: 2
55done!
56