PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/hphp/test/zend/bad/ext/mysql/tests/bug53649.php

http://github.com/facebook/hiphop-php
PHP | 45 lines | 35 code | 10 blank | 0 comment | 9 complexity | caf34c1601a65783651ecf67dbaf291c 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. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
  4. printf("[001] Connect failed, [%d] %s\n", mysqlerrno(), mysqli_error());
  5. }
  6. if (!mysql_query("DROP TABLE IF EXISTS test", $link)) {
  7. printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link));
  8. }
  9. if (!mysql_query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link)) {
  10. printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
  11. }
  12. if (false === file_put_contents('bug53649.data', "1\n2\n3\n"))
  13. printf("[004] Failed to create data file\n");
  14. if (!mysql_query("SELECT 1 FROM DUAL", $link))
  15. printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
  16. if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE test", $link)) {
  17. printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
  18. echo "bug";
  19. } else {
  20. echo "done";
  21. }
  22. mysql_close($link);
  23. ?>
  24. <?php
  25. require_once('connect.inc');
  26. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
  27. printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  28. $host, $user, $db, $port, $socket);
  29. }
  30. if (!mysql_query($link, 'DROP TABLE IF EXISTS test', $link)) {
  31. printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  32. }
  33. mysql_close($link);
  34. unlink('bug53649.data');
  35. ?>