1--TEST--
2mysqli binding resulting of a fetch and fetching a row directly produce same results
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
8mysqli_check_skip_test();
9?>
10--FILE--
11<?php
12require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
13
14    $link = default_mysqli_connect();
15
16    mysqli_query(
17        $link,
18        "CREATE TABLE test_bind_fetch_and_row_fetch(
19            c1 tinyint, c2 smallint,
20            c3 int, c4 bigint,
21            c5 decimal(4,2), c6 double,
22            c7 varbinary(10),
23            c8 varchar(10)
24        ) ENGINE=" . get_default_db_engine()
25    );
26
27    mysqli_query($link, "INSERT INTO test_bind_fetch_and_row_fetch
28        VALUES(120,2999,3999,54, 2.6,58.89, '206','6.7')");
29
30    $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch_and_row_fetch");
31
32    $c = array(0,0,0,0,0,0,0,0);
33    mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
34    mysqli_stmt_execute($stmt);
35    mysqli_stmt_fetch($stmt);
36    mysqli_stmt_close($stmt);
37
38    $result = mysqli_query($link, "SELECT * FROM test_bind_fetch_and_row_fetch");
39    $d = mysqli_fetch_row($result);
40    mysqli_free_result($result);
41
42    $test = "";
43    for ($i=0; $i < count($c); $i++)
44        $test .= ($c[$i] == $d[$i]) ? "1" : "0";
45    if ($test == "11111111")
46        echo "ok\n";
47    else
48        echo "error";
49
50    mysqli_close($link);
51    print "done!";
52?>
53--CLEAN--
54<?php
55require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
56tear_down_table_on_default_connection('test_bind_fetch_and_row_fetch');
57?>
58--EXPECT--
59ok
60done!
61