<?php
// Modification log
// (date)       (author)    (activity/purpose)
// 25.10.04     T. Gildseth Fixed bug with duplicate error code value.
//
// Todo
// (date)       (author)    (activity/purpose)
//
require_once 'PEAR.php';

define('DBTI_ERROR'1);
define('DBTI_WRONG_TABLE'2);
define('DBTI_UNSUPORTED_DATABASE'3);
define('DBTI_NO_CURRVAL'4);
define('DBTI_NO_SEQUENCE'5);

/**
 * An error class for the DBTableInfo class
 *
 * An error class for the DBTableInfo class.
 * This class provides a PEAR style error class for the DBTableInfo class.
 *
 * @author Tommy Gildseth <tommy@akili.no>;
 * @copyright Tommy Gildseth, September 2004
 * @version 0.1
 * @access public
 * @package DBTableInfo
 */
class DBTIError extends PEAR_Error {
    
//{{{ Class members
    /**
     * Array of error code to error message mappings.
     *
     * @access private
     */
    
var $_messages = array(DBTI_ERROR => 'Unknown error',
                           
DBTI_WRONG_TABLE => 'Unable to retrieve information.
                                                Did you supply the correct table name?'
,
                           
DBTI_UNSUPORTED_DATABASE => 'I don\'t know how to work with this RDBMS.',
                           
DBTI_NO_CURRVAL => 'There doesn\'t seem exist a currval() for the sequence for this session.',
                           
DBTI_NO_SEQUENCE => 'There is no sequence on this table.');
    
// }}}

    // {{{ constructor DBTInfoError(int code)
    /**
     * DBInfoError constructor.
     *
     * @param int       $code   error code
     * @access public
     */
    
function DBTIError($code DBTI_ERROR) {
        
$this->PEAR_Error('DBTInfo Error: ' $this->_messages[$code],
                          
$code,
                          
PEAR_ERROR_RETURN,
                          
E_USER_NOTICE);
    } 
// }}}
}
?>