.

DBFieldText Class Reference
[Model]

A text field im DB. More...

Inheritance diagram for DBFieldText:
DBField IDBField IPolicyHolder DBFieldBlob DBFieldSerialized

List of all members.

Public Member Functions

  __construct ($name, $length=255, $default_value=null, $policy=self::NONE)
  get_length ()
  validate ($value)
  Returns true, if the value passed fits the fields restrictions.

Public Attributes

const  BLOB_LENGTH_LARGE = 4294967295
const  BLOB_LENGTH_MEDIUM = 16777215
const  BLOB_LENGTH_SMALL = 65535

Protected Attributes

  $length = 255

Detailed Description

A text field im DB.

Attention:
A string of length 0 is treated as NULL, too
Author:
Gerd Riesselmann

Definition at line 10 of file dbfield.text.cls.php.


Constructor & Destructor Documentation

DBFieldText::__construct ( name,
length = 255,
default_value = null,
policy = self::NONE  
)

Reimplemented from DBField.

Reimplemented in DBFieldSerialized.

Definition at line 21 of file dbfield.text.cls.php.

00021                                                                                                      {
00022                 parent::__construct($name, $default_value, $policy);
00023                 $this->length = $length;
00024         }

Member Function Documentation

DBFieldText::get_length (  ) 

Definition at line 57 of file dbfield.text.cls.php.

00057                                      {
00058                 return $this->length;
00059         }
DBFieldText::validate ( value  ) 

Returns true, if the value passed fits the fields restrictions.

Parameters:
string  $value
Returns:
Status

Reimplemented from DBField.

Reimplemented in DBFieldBlob, and DBFieldSerialized.

Definition at line 32 of file dbfield.text.cls.php.

00032                                          {
00033                 $ret = new Status();
00034                 $l = String::length(Cast::string($value));
00035                 if ($l > $this->length) {
00036                         $ret->append(tr(
00037                                 '%field may have no more than %num character', 
00038                                 'core', 
00039                                 array(
00040                                         '%field' => $this->get_field_name_translation(),
00041                                         '%num' => $this->length
00042                                 )
00043                         ));
00044                 }
00045                 else if ($l == 0 && !$this->get_null_allowed()) {
00046                         $ret->append(tr(
00047                                 '%field may not be empty', 
00048                                 'core', 
00049                                 array(
00050                                         '%field' => $this->get_field_name_translation(),
00051                                 )
00052                         ));
00053                 }
00054                 return $ret;
00055         }

Member Data Documentation

DBFieldText::$length = 255 [protected]

Definition at line 19 of file dbfield.text.cls.php.

const DBFieldText::BLOB_LENGTH_LARGE = 4294967295

Definition at line 11 of file dbfield.text.cls.php.

Definition at line 12 of file dbfield.text.cls.php.

Definition at line 13 of file dbfield.text.cls.php.


The documentation for this class was generated from the following file: