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