1--TEST--
2mysqli insert (bind_param + bind_result) with send_long_data
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($link,"CREATE TABLE insert_bind_send_long_data(c1 varchar(10), c2 text)");
20
21    $stmt = mysqli_prepare ($link, "INSERT INTO insert_bind_send_long_data VALUES (?,?)");
22    mysqli_stmt_bind_param($stmt, "sb", $c1, $c2);
23
24    $c1 = "Hello World";
25
26    mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence.");
27    mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence.");
28    mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence.");
29
30    mysqli_stmt_execute($stmt);
31    mysqli_stmt_close($stmt);
32
33    $stmt = mysqli_prepare($link, "SELECT * FROM insert_bind_send_long_data");
34    mysqli_stmt_bind_result($stmt, $d1, $d2);
35    mysqli_stmt_execute($stmt);
36    mysqli_stmt_fetch($stmt);
37
38    $test = array($d1,$d2);
39
40    var_dump($test);
41
42    mysqli_stmt_close($stmt);
43    mysqli_close($link);
44    print "done!";
45?>
46--CLEAN--
47<?php
48require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
49tear_down_table_on_default_connection('insert_bind_send_long_data');
50?>
51--EXPECT--
52array(2) {
53  [0]=>
54  string(10) "Hello Worl"
55  [1]=>
56  string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence."
57}
58done!
59