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