PHP Classes
Icontem

File: DATA/SQLTypeConstraintFailed.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Martin Alterisio  >  DATA  >  DATA/SQLTypeConstraintFailed.php  
File: DATA/SQLTypeConstraintFailed.php
Role: Class source
Content type: text/plain
Description: An exception thrown when an sql type constraint fails to apply to a value.
Class: DATA
Access data stored in MySQL tables like arrays
 

Contents

Class file image Download
<?php
/**
 * @package DATA
 */

/**
 * An exception thrown when an sql type constraint fails to apply to a value.
 */
abstract class DATA_SQLTypeConstraintFailed extends DATA_Exception {
    
/**
     * The table name where the constraint occured.
     * @var string
     */
    
private $table;
    
/**
     * The field name where the constraint occured.
     * @var string
     */
    
private $field;
    
    
/**
     * Default constructor.
     * 
     * @param string $message Message of exception.
     * @param int $code Code of exception.
     */
    
public function __construct($message null$code 0) {
        
parent::__construct($message$code);
        
$this->table null;
        
$this->field null;
    }
    
    
/**
     * Gets the table name where the constraint occured.
     * 
     * @return string The table name where the constraint occured.
     */
    
final public function getTable() {
        return 
$this->table;
    }
    
    
/**
     * Gets the field name where the constraint occured.
     * 
     * @return string The field name where the constraint occured.
     */
    
final public function getField() {
        return 
$this->field;
    }
    
    
/**
     * Sets the table name where the constraint occured.
     * 
     * @param string $table The table name where the constraint occured.
     */
    
final public function setTable($table) {
        
$this->table $table;
    }
    
    
/**
     * Sets the field name where the constraint occured.
     * 
     * @param string $field The field name where the constraint occured.
     */
    
final public function setField($field) {
        
$this->field $field;
    }
    
    
public function __toString() {
        
$oldMessage $this->message;
        if (
$this->table && $this->field) {
            
$this->message "[{$this->table}.{$this->field}] " $this->message;
        }
        
$str parent::__toString();
        
$this->message $oldMessage;
        return 
$str;
    }
}
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products