023.phpt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. --TEST--
  2. mysqli bind_param/bind_prepare fetch long values
  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, "SET sql_mode=''");
  16. mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
  17. mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
  18. c2 int unsigned,
  19. c3 int,
  20. c4 int,
  21. c5 int,
  22. c6 int unsigned,
  23. c7 int)");
  24. $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
  25. mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);
  26. $c1 = -23;
  27. $c2 = 35999;
  28. $c3 = NULL;
  29. $c4 = -500;
  30. $c5 = -9999999;
  31. $c6 = -0;
  32. $c7 = 0;
  33. mysqli_stmt_execute($stmt);
  34. mysqli_stmt_close($stmt);
  35. $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
  36. mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
  37. mysqli_stmt_execute($stmt);
  38. mysqli_stmt_fetch($stmt);
  39. $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
  40. var_dump($test);
  41. mysqli_stmt_close($stmt);
  42. mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
  43. mysqli_close($link);
  44. print "done!";
  45. ?>
  46. --CLEAN--
  47. <?php
  48. require_once("connect.inc");
  49. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  50. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  51. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
  52. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  53. mysqli_close($link);
  54. ?>
  55. --EXPECT--
  56. array(7) {
  57. [0]=>
  58. int(0)
  59. [1]=>
  60. int(35999)
  61. [2]=>
  62. NULL
  63. [3]=>
  64. int(-500)
  65. [4]=>
  66. int(-9999999)
  67. [5]=>
  68. int(0)
  69. [6]=>
  70. int(0)
  71. }
  72. done!