home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / bug22328.phpt < prev    next >
Encoding:
Text File  |  2004-10-01  |  1.2 KB  |  63 lines

  1. --TEST--
  2. DB_driver::bug22328
  3. --INI--
  4. error_reporting = 2047
  5. --SKIPIF--
  6. <?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
  7. --FILE--
  8. <?php
  9. require_once './connect.inc';
  10.  
  11. /**
  12.  * Local error callback handler.
  13.  *
  14.  * Drops the phptest table, prints out an error message and kills the
  15.  * process.
  16.  *
  17.  * @param object  $o  PEAR error object automatically passed to this method
  18.  * @return void
  19.  * @see PEAR::setErrorHandling()
  20.  */
  21. function pe($o) {
  22.     global $dbh;
  23.  
  24.     $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  25.     $dbh->query('DROP TABLE php_limit');
  26.  
  27.     die($o->toString());
  28. }
  29.  
  30.  
  31. $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  32. $dbh->query('DROP TABLE php_limit');
  33.  
  34. $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
  35.  
  36. $dbh->query('CREATE TABLE php_limit (a CHAR(20))');
  37.  
  38.  
  39. $res = $dbh->query('select * from php_limit');
  40. $error = 0;
  41. while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) {
  42.     if (DB::isError($row) && $error) {
  43.         die('bug');
  44.     }
  45.     $res2 = $dbh->query("FAKE QUERY");
  46.     if (!DB::isError($res2)) {
  47.         die('bug');
  48.     }
  49.     $error = true;
  50. }
  51.  
  52.  
  53. switch ($dbh->phptype) {
  54.     case 'ibase':
  55.         $dbh->freeResult($res->result);  // Make interbase happy.
  56.         break;
  57. }
  58. $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  59. $dbh->query('DROP TABLE php_limit');
  60.  
  61. ?>
  62. --EXPECT--
  63.