PageRenderTime 1331ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://github.com/facebook/hiphop-php
PHP | 44 lines | 33 code | 10 blank | 1 comment | 6 complexity | 21f11bc54cb08c27d9bab9bdfd74f537 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. include_once "connect.inc";
  3. $tmp = NULL;
  4. $link = NULL;
  5. // NOTE: again this test does not test all of the behaviour of the function
  6. if (NULL !== ($tmp = mysql_drop_db()))
  7. printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
  8. require('table.inc');
  9. if (!mysql_query('DROP DATABASE IF EXISTS mysqldropdb'))
  10. printf("[004] [%d] %s\n", mysql_errno($link), mysql_error($link));
  11. if (!mysql_query('CREATE DATABASE mysqldropdb'))
  12. die(sprintf("[005] Skipping, can't create test database. [%d] %s\n", mysql_errno($link), mysql_error($link)));
  13. if (true !== ($tmp = mysql_drop_db('mysqldropdb', $link)))
  14. printf("[006] Can't drop, got %s/%s. [%d] %s\n",
  15. gettype($tmp), $tmp,
  16. mysql_errno($link), mysql_error($link));
  17. if (false !== ($tmp = mysql_drop_db('mysqldropdb', $link)))
  18. printf("[007] Expecting boolean/false, got %s/%s. [%d] %s\n",
  19. gettype($tmp), $tmp,
  20. mysql_errno($link), mysql_error($link));
  21. mysql_close($link);
  22. print "done!\n";
  23. ?>
  24. <?php error_reporting(0); ?>
  25. <?php
  26. require_once('connect.inc');
  27. if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket))
  28. printf("[c001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
  29. $host, $user, $db, $port, $socket);
  30. if (!mysql_query("DROP DATABASE IF EXISTS mysqldropdb", $link))
  31. printf("[c002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  32. mysql_close($link);
  33. ?>