1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-21 09:47:47 +02:00
Files
php-dibi/dibi/libs/exception.php
David Grudl 6536dfb7dd + rewritten support for logging & error handling
+ modifier %sn
* modifier %sql
* changed modifier behaviour: NULL is always 'NULL'
2007-01-29 05:08:52 +00:00

60 lines
1.2 KiB
PHP

<?php
/**
* dibi - Database Abstraction Layer according to dgx
* --------------------------------------------------
*
* This source file is subject to the GNU GPL license.
*
* @author David Grudl aka -dgx- <dave@dgx.cz>
* @link http://dibi.texy.info/
* @copyright Copyright (c) 2005-2007 David Grudl
* @license GNU GENERAL PUBLIC LICENSE v2
* @package dibi
* @category Database
* @version $Revision$ $Date$
*/
// security - include dibi.php, not this file
if (!defined('DIBI')) die();
/**
* dibi exception class
*
*/
class DibiException extends Exception
{
private
$info;
public function __construct($message, $info=NULL) {
$this->info = $info;
if (isset($info['message']))
$message = "$message: $info[message]";
parent::__construct($message);
}
public function getSql()
{
return isset($this->info['sql']) ? $this->info['sql'] : NULL;
}
public function __toString()
{
$s = parent::__toString();
if (isset($this->info['sql']))
$s .= "\nSQL: " . $this->info['sql'];
return $s;
}
} // class DibiException