022.phpt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. --TEST--
  2. mysqli bind_param/bind_result char/text long
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once("connect.inc");
  12. /*** test mysqli_connect 127.0.0.1 ***/
  13. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  14. mysqli_select_db($link, $db);
  15. mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
  16. mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
  17. $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
  18. mysqli_stmt_bind_param($stmt, "ss", $a1, $a2);
  19. $a1 = "1234567890";
  20. $a2 = str_repeat("A1", 32000);
  21. mysqli_stmt_execute($stmt);
  22. mysqli_stmt_close($stmt);
  23. $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
  24. mysqli_stmt_bind_result($stmt, $c1, $c2);
  25. mysqli_stmt_execute($stmt);
  26. mysqli_stmt_fetch($stmt);
  27. $test[] = $c1;
  28. $test[] = ($a2 == $c2) ? "32K String ok" : "32K String failed";
  29. var_dump($test);
  30. mysqli_stmt_close($stmt);
  31. mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
  32. mysqli_close($link);
  33. print "done!";
  34. ?>
  35. --CLEAN--
  36. <?php
  37. require_once("connect.inc");
  38. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  39. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  40. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
  41. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  42. mysqli_close($link);
  43. ?>
  44. --EXPECTF--
  45. array(2) {
  46. [0]=>
  47. string(10) "1234567890"
  48. [1]=>
  49. %s(13) "32K String ok"
  50. }
  51. done!