<?php
defined('VSIGN') or die("Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.");

class Data
{
	protected $db;
	private $errorNo;
	private $errorMessage;

        /**
         * Data Class
         * @param database $db
         */
	public function __construct(database $db)
	{
		$this->db =& $db;
		
		$this->error		= false;
		$this->errorNo 		= 0;
		$this->errorMessage	= '';
	}
	
	/**
	 * Gets the error state
	 * @return 
	 */
	public function IsError()
	{
		return $this->error;
	}
	
	/**
	 * Gets the Error Number
	 * @return 
	 */
	public function GetErrorNumber()
	{
		return $this->errorNo;
	}
	
	/**
	 * Gets the Error Message
	 * @return 
	 */
	public function GetErrorMessage()
	{
		return $this->errorMessage;
	}
	
	/**
	 * Sets the Error for this Data object
	 * @return 
	 * @param $errNo Object
	 * @param $errMessage Object
	 */
	protected function SetError($errNo, $errMessage = '')
	{
		$this->error		= true;
		$this->errorNo 		= $errNo;
		$this->errorMessage	= $errMessage;
		
		Debug::LogEntry($this->db, 'audit', sprintf('Data Class: Error Number [%d] Error Message [%s]', $errNo, $errMessage), 'Data Module', 'SetError');

                // Return false so that we can use this method as the return call for parent methods
		return false;
	}
} 
?>