1
0
mirror of https://github.com/dg/dibi.git synced 2025-10-22 10:16:02 +02:00
Files
php-dibi/dibi/libs/exception.php
David Grudl d35a850311 * removed $throwExceptions (always throws)
* added DibiLogger, dibi::notify(), dibi::startLogger()
* miniprofiler dibi::$numOfQueries, $totalTime, $elapsedTime
* simplified DibiException, added DibiDatabaseException
* Dibi::nativeQuery splitted into DibiDriver::doQuery & nativeQuery()
* moved dibi::dumpResult -> DibiResult::dump()
* moved dibi::test() -> DibiDriver::test()
* DibiTranslator generates $mask
2007-09-29 07:53:25 +00:00

59 lines
1.0 KiB
PHP

<?php
/**
* This file is part of the "dibi" project (http://dibi.texy.info/)
*
* @author David Grudl
* @copyright Copyright (c) 2005-2007 David Grudl aka -dgx- (http://www.dgx.cz)
* @license New BSD License
* @version $Revision$ $Date$
* @category Database
* @package Dibi
*/
/**
* dibi common exception
*/
class DibiException extends Exception
{
}
/**
* database server exception
*/
class DibiDatabaseException extends DibiException
{
/** @var string */
private $sql;
public function __construct($message = NULL, $code = 0, $sql = NULL)
{
parent::__construct($message);
$this->sql = $sql;
dibi::notify('exception', NULL, $this);
}
final public function getSql()
{
return $this->sql;
}
public function __toString()
{
$s = parent::__toString();
if ($this->sql) {
$s .= "\nSQL: " . $this->sql;
}
return $s;
}
}