home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / simplequery.inc < prev    next >
Encoding:
Text File  |  2004-03-24  |  837 b   |  42 lines

  1. <?php
  2.  
  3. /**
  4.  * Local error callback handler.
  5.  *
  6.  * Drops the phptest table, prints out an error message and kills the
  7.  * process.
  8.  *
  9.  * @param object  $o  PEAR error object automatically passed to this method
  10.  * @return void
  11.  * @see PEAR::setErrorHandling()
  12.  */
  13. function pe($o) {
  14.     global $dbh;
  15.  
  16.     $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  17.     $dbh->query('DROP TABLE phptest');
  18.  
  19.     die($o->toString());
  20. }
  21.  
  22. $dbh->setErrorHandling(PEAR_ERROR_CALLBACK, 'pe');
  23.  
  24.  
  25. $sth = $dbh->simpleQuery("SELECT * FROM phptest");
  26. print gettype($sth)."\n";
  27.  
  28.  
  29. switch ($dbh->phptype) {
  30.     case 'ibase':
  31.         /*
  32.          * Interbase doesn't allow dropping tables that have result
  33.          * sets still open.
  34.          */
  35.         $dbh->freeResult($sth);
  36.         break;
  37. }
  38. $dbh->setErrorHandling(PEAR_ERROR_RETURN);
  39. $dbh->query('DROP TABLE phptest');
  40.  
  41. ?>
  42.