1--TEST-- 2mysqli bind_param/bind_result with send_long_data 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8?> 9--FILE-- 10<?php 11 require_once 'connect.inc'; 12 13 /*** test mysqli_connect 127.0.0.1 ***/ 14 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); 15 16 mysqli_select_db($link, $db); 17 mysqli_query($link, "SET sql_mode=''"); 18 19 mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); 20 mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)"); 21 22 $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)"); 23 mysqli_stmt_bind_param($stmt, "sb", $c1, $c2); 24 25 $c1 = "Hello World"; 26 27 mysqli_stmt_send_long_data($stmt, 1, "This is the first sentence."); 28 mysqli_stmt_send_long_data($stmt, 1, " And this is the second sentence."); 29 mysqli_stmt_send_long_data($stmt, 1, " And finally this is the last sentence."); 30 31 mysqli_stmt_execute($stmt); 32 mysqli_stmt_close($stmt); 33 34 $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch"); 35 mysqli_stmt_bind_result($stmt, $d1, $d2); 36 mysqli_stmt_execute($stmt); 37 mysqli_stmt_fetch($stmt); 38 39 $test = array($d1,$d2); 40 41 var_dump($test); 42 43 mysqli_stmt_close($stmt); 44 mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"); 45 mysqli_close($link); 46 print "done!"; 47?> 48--CLEAN-- 49<?php 50require_once 'connect.inc'; 51if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 52 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); 53 54if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) 55 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 56 57mysqli_close($link); 58?> 59--EXPECT-- 60array(2) { 61 [0]=> 62 string(10) "Hello Worl" 63 [1]=> 64 string(99) "This is the first sentence. And this is the second sentence. And finally this is the last sentence." 65} 66done! 67