PHP Classes

File: DATA/StringTooLarge.php

Recommend this page to a friend!
  Classes of Martin Alterisio   DATA   DATA/StringTooLarge.php   Download  
File: DATA/StringTooLarge.php
Role: Class source
Content type: text/plain
Description: An exception thrown when a sql character field cannot hold the string provided by the user.
Class: DATA
Access data stored in MySQL tables like arrays
Author: By
Last change: + anonymous access
Date: 16 years ago
Size: 1,357 bytes
 

Contents

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

/**
 * An exception thrown when a sql character field cannot hold
 * the string provided by the user.
 */
class DATA_StringTooLarge extends DATA_SQLTypeConstraintFailed {
   
/**
     * The maximum size that was expected.
     * @var int
     */
   
private $expectedSize;
   
/**
     * The string that failed the constraint.
     * @var string
     */
   
private $providedString;
   
   
/**
     * Constructor.
     *
     * @param int $expectedSize The maximum size that was expected.
     * @param string $providedString The string that failed the constraint.
     */
   
public function __construct($expectedSize, $providedString) {
       
parent::__construct("SQL char field of $expectedSize characters cannot hold '$providedString'");
       
$this->expectedSize = $expectedSize;
       
$this->providedString = $providedString;
    }
   
   
/**
     * Returns the maximum size expected.
     *
     * @return int Maximum size expected.
     */
   
public function getExpectedSize() {
        return
$this->expectedSize;
    }
   
   
/**
     * Returns the string that failed the constraint.
     *
     * @return string String that failed the constraint.
     */
   
public function getProvidedString() {
        return
$this->providedString;
    }
}
?>