[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/adodb_lite/ -> adodb-errorpear.inc.php (source)

   1  <?php
   2  /** 
   3   * @version V4.66 28 Sept 2005 (c) 2000-2005 John Lim (jlim@natsoft.com.my). All rights reserved.
   4   * Released under both BSD license and Lesser GPL library license. 
   5   * Whenever there is any discrepancy between the two licenses, 
   6   * the BSD license will take precedence. 
   7   *
   8   * Set tabs to 4 for best viewing.
   9   * 
  10   * Latest version is available at http://php.weblogs.com
  11   * 
  12  */
  13  include_once('PEAR.php');
  14  
  15  if (!defined('ADODB_ERROR_HANDLER'))
  16      define('ADODB_ERROR_HANDLER','ADODB_Error_PEAR');
  17  
  18  /*
  19  * Enabled the following if you want to terminate scripts when an error occurs
  20  */
  21  //PEAR::setErrorHandling (PEAR_ERROR_DIE);
  22  
  23  /*
  24  * Name of the PEAR_Error derived class to call.
  25  */
  26  if (!defined('ADODB_PEAR_ERROR_CLASS'))
  27      define('ADODB_PEAR_ERROR_CLASS','PEAR_Error');
  28  
  29  /*
  30  * Store the last PEAR_Error object here
  31  */
  32  global $ADODB_Last_PEAR_Error;
  33  
  34  $ADODB_Last_PEAR_Error = false;
  35  
  36    /**
  37  * Error Handler with PEAR support. This will be called with the following params
  38  *
  39  * @param $dbms        the RDBMS you are connecting to
  40  * @param $fn        the name of the calling function (in uppercase)
  41  * @param $errno        the native error number from the database 
  42  * @param $errmsg    the native error msg from the database
  43  * @param $p1        $fn specific parameter - see below
  44  * @param $P2        $fn specific parameter - see below
  45      */
  46  function ADODB_Error_PEAR($dbms, $fn, $errno, $errmsg, $p1=false, $p2=false)
  47  {
  48      global $ADODB_Last_PEAR_Error;
  49  
  50      if (error_reporting() == 0)
  51          return; // obey @ protocol
  52  
  53      switch($fn) {
  54          case 'EXECUTE':
  55              $sql = $p1;
  56              $inputparams = $p2;
  57              $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")";
  58              break;
  59  
  60          case 'PCONNECT':
  61          case 'CONNECT':
  62              $host = $p1;
  63              $database = $p2;
  64              $s = "$dbms error: [$errno: $errmsg] in $fn('$host', ?, ?, '$database')";
  65              break;
  66  
  67          default:
  68              $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
  69              break;
  70      }
  71  
  72      $class = ADODB_PEAR_ERROR_CLASS;
  73      $ADODB_Last_PEAR_Error = new $class($s, $errno, $GLOBALS['_PEAR_default_error_mode'], $GLOBALS['_PEAR_default_error_options'], $errmsg);
  74      //print "<p>!$s</p>";
  75      trigger_error($s, E_USER_WARNING); // Just warning so that error will not be hidden by CMSMS tabs
  76  }
  77  
  78  /**
  79  * Returns last PEAR_Error object. This error might be for an error that
  80  * occured several sql statements ago.
  81  */
  82  function &ADODB_PEAR_Error()
  83  {
  84      global $ADODB_Last_PEAR_Error;
  85  
  86      return $ADODB_Last_PEAR_Error;
  87  }
  88  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7