PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/mysqli/tests/mysqli_stmt_data_seek.php

http://github.com/facebook/hiphop-php
PHP | 71 lines | 48 code | 23 blank | 0 comment | 15 complexity | cb15536fd9dd7b0d31dd27f6d175aac7 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. require_once("connect.inc");
  3. $tmp = NULL;
  4. $link = NULL;
  5. $test_table_name = 'test_mysqli_stmt_data_seek_table_1'; require('table.inc');
  6. if (!$stmt = mysqli_stmt_init($link))
  7. printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  8. if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 1)))
  9. printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  10. if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test_mysqli_stmt_data_seek_table_1 ORDER BY id"))
  11. printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  12. if (true !== ($tmp = mysqli_stmt_execute($stmt)))
  13. printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
  14. $id = null;
  15. if (!mysqli_stmt_bind_result($stmt, $id))
  16. printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  17. if (!mysqli_stmt_store_result($stmt))
  18. printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  19. if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 2)))
  20. printf("[009] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  21. if (!mysqli_stmt_fetch($stmt))
  22. printf("[010] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  23. var_dump($id);
  24. if (!is_null($tmp = mysqli_stmt_data_seek($stmt, 0)))
  25. printf("[011] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  26. if (!mysqli_stmt_fetch($stmt))
  27. printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  28. var_dump($id);
  29. if (!is_null($tmp = mysqli_stmt_data_seek($stmt, mysqli_stmt_num_rows($stmt) + 100)))
  30. printf("[013] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  31. if (mysqli_stmt_fetch($stmt))
  32. printf("[014] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  33. var_dump($id);
  34. if (false !== ($tmp = mysqli_stmt_data_seek($stmt, -1)))
  35. printf("[015] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  36. if (mysqli_stmt_fetch($stmt))
  37. printf("[016] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
  38. var_dump($id);
  39. mysqli_stmt_close($stmt);
  40. if (NULL !== ($tmp = mysqli_stmt_data_seek($stmt, 0)))
  41. printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
  42. mysqli_close($link);
  43. print "done!";
  44. ?>
  45. <?php error_reporting(0); ?>
  46. <?php
  47. $test_table_name = 'test_mysqli_stmt_data_seek_table_1'; require_once("clean_table.inc");
  48. ?>