1--TEST--
2mysqli insert (bind_param + bind_result) integer types
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    // To get consistent result without depending on the DB version/setup
17    mysqli_query($link, "SET sql_mode=''");
18
19    mysqli_query(
20        $link,
21        "CREATE TABLE insert_bind_integers(
22            c1 int unsigned,
23            c2 int unsigned,
24            c3 int,
25            c4 int,
26            c5 int,
27            c6 int unsigned,
28            c7 int
29        )"
30    );
31
32    $stmt = mysqli_prepare($link, "INSERT INTO insert_bind_integers VALUES (?,?,?,?,?,?,?)");
33    mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
34    $c1 = -23;
35    $c2 = 35999;
36    $c3 = NULL;
37    $c4 = -500;
38    $c5 = -9999999;
39    $c6 = -0;
40    $c7 = 0;
41
42    mysqli_stmt_execute($stmt);
43    mysqli_stmt_close($stmt);
44
45    $stmt = mysqli_prepare($link, "SELECT * FROM insert_bind_integers");
46    mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
47    mysqli_stmt_execute($stmt);
48    mysqli_stmt_fetch($stmt);
49
50    $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
51
52    var_dump($test);
53
54    mysqli_stmt_close($stmt);
55    mysqli_close($link);
56
57    print "done!";
58?>
59--CLEAN--
60<?php
61require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
62tear_down_table_on_default_connection('insert_bind_integers');
63?>
64--EXPECT--
65array(7) {
66  [0]=>
67  int(0)
68  [1]=>
69  int(35999)
70  [2]=>
71  NULL
72  [3]=>
73  int(-500)
74  [4]=>
75  int(-9999999)
76  [5]=>
77  int(0)
78  [6]=>
79  int(0)
80}
81done!
82