* added a getDefinition for columns and indexes - I am not very sure it's a very...
[vsc.git] / _res / _libs / models / foo / fields / foofieldvarchar.class.php
blob3fd8c7226871cad6f432b6f2ebd30cdda43dab4b
1 <?php
2 /**
3 * @package ts_models
4 * @author Marius Orcsik <marius@habarnam.ro>
5 * @date 09.05.01
6 */
7 class fooFieldVarChar extends fooFieldA {
8 const TYPE = 'varchar';
9 protected $maxLength = 255;
10 protected $encoding = 'UTF-8';
12 public function isVarChar (fooFieldA $oField) {
13 return ($oField instanceof self);
16 public function getType () {
17 return self::TYPE;
20 protected function escape () {
21 // need a mechanism based on the connection type
22 // TODO
23 return $this->value;
26 public function getEncoding () {
27 return $this->encoding;
30 public function setEncoding ($sEncoding) {
31 $this->encoding = $sEncoding;
34 public function getDefinition () {
35 // this is totally wrong for PostgreSQL
36 return $this->getType() .
37 ($this->getMaxLength() ? '(' . $this->getMaxLength() . ')' : '') .
38 ($this->getIsNullable() ? ' NULL' : ' NOT NULL');