066.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. function test: mysqli_warning object
  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. $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
  14. if (!mysqli_query($mysql, "SET sql_mode=''"))
  15. printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
  16. $mysql->query("DROP TABLE IF EXISTS test_warnings");
  17. $mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
  18. $mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
  19. if (($warning = $mysql->get_warnings())) {
  20. do {
  21. printf("Warning\n");
  22. } while ($warning->next());
  23. }
  24. $mysql->close();
  25. print "done!";
  26. ?>
  27. --CLEAN--
  28. <?php
  29. require_once("connect.inc");
  30. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  31. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  32. if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
  33. printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
  34. mysqli_close($link);
  35. ?>
  36. --EXPECT--
  37. Warning
  38. done!