PHP Classes
Icontem

File: DATA/InvalidDecimal.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/InvalidDecimal.php  
File: DATA/InvalidDecimal.php
Role: Class source
Content type: text/plain
Description: An exception thrown when a sql decimal field is filled with an invalid value or has overflown its capacity.
Class: DATA
Access data stored in MySQL tables like arrays
 

Contents

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

/**
 * An exception thrown when a sql decimal field is filled with an
 * invalid value or has overflown its capacity.
 */
class DATA_InvalidDecimal extends DATA_SQLTypeConstraintFailed {
    
/**
     * How many digits the field could hold.
     * @var int
     */
    
private $expectedPrecision;
    
/**
     * How many digits the field had after decimal point.
     * @var int
     */
    
private $expectedScale;
    
/**
     * The string that failed the constraint.
     * @var string
     */
    
private $providedNumber;
    
    
/**
     * Constructor.
     * 
     * @param int $expectedPrecision How many digits the field could hold.
     * @param int $expectedScale How many digits the field had after decimal point.
     * @param string $providedNumber The string that failed the constraint.
     */
    
public function __construct($expectedPrecision$expectedScale$providedNumber) {
        
parent::__construct("SQL numeric field of $expectedPrecision digits with $expectedScale decimals cannot hold '$providedNumber'");
        
$this->expectedPrecision $expectedPrecision;
        
$this->expectedScale $expectedScale;
        
$this->providedNumber $providedNumber;
    }
    
    
/**
     * Returns how many digits the field could hold.
     * 
     * @return int How many digits the field could hold.
     */
    
public function getExpectedPrecision() {
        return 
$this->expectedPrecision;
    }
    
    
/**
     * Returns how many digits the field had after decimal point.
     * 
     * @return int How many digits the field had after decimal point.
     */
    
public function getExpectedScale() {
        return 
$this->expectedScale;
    }
    
    
/**
     * Returns the string that failed the constraint.
     * 
     * @return string The string that failed the constraint.
     */
    
public function getProvidedNumber() {
        return 
$this->providedNumber;
    }
}
?>

 
  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