php File containing Csf_Db_Exception definition author XIAG Hagen hage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* File containing Csf_Db_Exception definition
* @author XIAG/Hagen <hagen@xiag.ch>
* @version $Id: Csf_Db_Exception.class,v 2.0 2006/09/08 07:22:21 maxim Exp $
* @package XLib
* @subpackage DB
*/
/**
* Class for SQL exception handling rouitine.
* @author XIAG/Hagen <hagen@xiag.ch>
* @version $Id: Csf_Db_Exception.class,v 2.0 2006/09/08 07:22:21 maxim Exp $
* @package XLib
* @subpackage DB
*/
class Csf_Db_Exception extends Exception {
/**
* @return Csf_Db_Exception
* @param string $sql SQL statement.
* @param string $err_str Error message.
* @param string $err_id Error code.
* @desc Exception constructor.
*/
function __construct ($sql, $err_str='', $err_id=0, $err_pos=0) {
parent::__construct();
$this->message=$err_str;
$this->code=$err_id;
$this->file=$sql;
$this->line=$err_pos;
}
function show() {
debug($this->sql, 'ERROR @ SQL');
$m="MESSAGE: ".$this->err_str."<br>\n";
$m.=($this->err_id)?('CODE: '.$this->err_id."<br>\n"):"";
$m.=($this->err_pos)?('Error at symbol: '.$this->err_pos):"";
debug($m, 'ERROR');
debug($this->getTrace(), 'TRACE');
}
}