[ 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-errorhandler.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  
  14  // added Claudio Bustos  clbustos#entelchile.net
  15  if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); 
  16  
  17  if (!defined('ADODB_ERROR_HANDLER')) define('ADODB_ERROR_HANDLER','ADODB_Error_Handler');
  18  
  19  /**
  20  * Default Error Handler. This will be called with the following params
  21  *
  22  * @param $dbms        the RDBMS you are connecting to
  23  * @param $fn        the name of the calling function (in uppercase)
  24  * @param $errno        the native error number from the database
  25  * @param $errmsg    the native error msg from the database
  26  * @param $p1        $fn specific parameter - see below
  27  * @param $p2        $fn specific parameter - see below
  28  * @param $thisConn    $current connection object - can be false if no connection object created
  29  */
  30  
  31  function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
  32  {
  33      if (error_reporting() == 0)
  34          return; // obey @ protocol
  35  
  36      switch($fn) {
  37          case 'EXECUTE':
  38              $sql = $p1;
  39              $inputparams = $p2;
  40              $s = "$dbms error: [$errno: $errmsg] in $fn(\"$sql\")\n";
  41              break;
  42  
  43          case 'PCONNECT':
  44          case 'CONNECT':
  45              $host = $p1;
  46              $database = $p2;
  47              $s = "$dbms error: [$errno: $errmsg] in $fn($host, '****', '****', $database)\n";
  48              break;
  49  
  50          default:
  51              $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
  52              break;
  53      }
  54      /*
  55      * Log connection error somewhere
  56      *    0 message is sent to PHP's system logger, using the Operating System's system
  57      *        logging mechanism or a file, depending on what the error_log configuration
  58      *        directive is set to.
  59      *    1 message is sent by email to the address in the destination parameter.
  60      *        This is the only message type where the fourth parameter, extra_headers is used.
  61      *        This message type uses the same internal function as mail() does.
  62      *    2 message is sent through the PHP debugging connection.
  63      *        This option is only available if remote debugging has been enabled.
  64      *        In this case, the destination parameter specifies the host name or IP address
  65      *        and optionally, port number, of the socket receiving the debug information.
  66      *    3 message is appended to the file destination
  67      */
  68      if (defined('ADODB_ERROR_LOG_TYPE')) {
  69          $t = date('Y-m-d H:i:s');
  70          if (defined('ADODB_ERROR_LOG_DEST'))
  71              error_log("($t) $s", ADODB_ERROR_LOG_TYPE, ADODB_ERROR_LOG_DEST);
  72          else
  73              error_log("($t) $s", ADODB_ERROR_LOG_TYPE);
  74      }
  75  
  76      //print "<p>$s</p>";
  77      trigger_error($s, ADODB_ERROR_HANDLER_TYPE); 
  78  }
  79  ?>


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