<?php
/**
 * ****************************************************************
 * Project:      brunkow
 * Copyright:    Copyright (c) 2006
 * Company:      avantage
 * ****************************************************************
 * $Workfile:   SQLException.php  $
 * ****************************************************************
 * Description:  special exception for mysql error
 * ****************************************************************/
class SQLException extends Exception {
	private $mysqlError;
	private $errno;
	private $errnoDesc;
	private $statement;

  /*****************************************************************
	 * constructor
	 *****************************************************************/	
	public function __construct($_message, $_code = 0, $_statement ='' )
	{
		$this->mysqlError = $_message;
		parent::__construct($_message, $_code);
		$this->statement = $_statement;
	}
	
	public function __toString()
	{
		$ret = 'MySQL error: ' . $this->mysqlError . ', errno: ' . $this->errno;
		
		if ($this->statement != '')
			$ret = $ret.', statement: '.$this->statement;
		return $ret;
	}
	
	public function setErrno($_value)
	{
		$this->errno = $_value;
	}
	
	public function getErrno()
	{
		return $this->errno;
	}
	
	public function getErrnoDescription()
	{
		return $this->errnoDesc;
	}
	
	public function setErrnoDescription($_value)
	{
		$this->errnoDesc = $_value;
	}
}
?>