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