Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
1 <?php 2 3 /** 4 * @version v5.21.0 2021-02-27 5 * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved. 6 * @copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community 7 * Released under both BSD license and Lesser GPL library license. 8 * Whenever there is any discrepancy between the two licenses, 9 * the BSD license will take precedence. 10 * 11 * Set tabs to 4 for best viewing. 12 * 13 * Latest version is available at https://adodb.org/ 14 * 15 * Exception-handling code using PHP5 exceptions (try-catch-throw). 16 */ 17 18 19 if (!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE',E_USER_ERROR); 20 define('ADODB_ERROR_HANDLER','adodb_throw'); 21 22 class ADODB_Exception extends Exception { 23 var $dbms; 24 var $fn; 25 var $sql = ''; 26 var $params = ''; 27 var $host = ''; 28 var $database = ''; 29 30 function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) 31 { 32 switch($fn) { 33 case 'EXECUTE': 34 $this->sql = is_array($p1) ? $p1[0] : $p1; 35 $this->params = $p2; 36 $s = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")"; 37 break; 38 39 case 'PCONNECT': 40 case 'CONNECT': 41 $user = $thisConnection->user; 42 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)"; 43 break; 44 default: 45 $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)"; 46 break; 47 } 48 49 $this->dbms = $dbms; 50 if ($thisConnection) { 51 $this->host = $thisConnection->host; 52 $this->database = $thisConnection->database; 53 } 54 $this->fn = $fn; 55 $this->msg = $errmsg; 56 57 if (!is_numeric($errno)) $errno = -1; 58 parent::__construct($s,$errno); 59 } 60 } 61 62 /** 63 * Default Error Handler. 64 * 65 * @param string $dbms the RDBMS you are connecting to 66 * @param string $fn the name of the calling function (in uppercase) 67 * @param int $errno the native error number from the database 68 * @param string $errmsg the native error msg from the database 69 * @param mixed $p1 $fn specific parameter - see below 70 * @param mixed $p2 $fn specific parameter - see below 71 */ 72 73 function adodb_throw($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection) 74 { 75 global $ADODB_EXCEPTION; 76 77 if (error_reporting() == 0) return; // obey @ protocol 78 if (is_string($ADODB_EXCEPTION)) $errfn = $ADODB_EXCEPTION; 79 else $errfn = 'ADODB_EXCEPTION'; 80 throw new $errfn($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection); 81 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body