1--TEST--
2mysqli_store_result()
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require_once("connect.inc");
11
12    require('table.inc');
13
14    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
15        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
16
17    if (!is_object($res = mysqli_store_result($link)))
18        printf("[004] Expecting object, got %s/%s. [%d] %s\n",
19            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
20
21    if (true !== ($tmp = mysqli_data_seek($res, 2)))
22        printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
23            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
24
25    mysqli_free_result($res);
26
27    if (!mysqli_query($link, "DELETE FROM test"))
28        printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
29
30    if (false !== ($res = mysqli_store_result($link)))
31        printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
32            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
33
34    if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id"))
35        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
36
37    if (false !== ($tmp = mysqli_data_seek($res, 1)))
38        printf("[009] Expecting boolean/false, got %s/%s\n",
39            gettype($tmp), $tmp);
40
41    mysqli_close($link);
42
43    try {
44        mysqli_store_result($link);
45    } catch (Error $exception) {
46        echo $exception->getMessage() . "\n";
47    }
48
49    print "done!";
50?>
51--CLEAN--
52<?php
53    require_once("clean_table.inc");
54?>
55--EXPECT--
56mysqli object is already closed
57done!
58