_setSimplifiedType() protected method

protected _setSimplifiedType ( )
Example #1
0
 /**
  */
 protected function _setSimplifiedType()
 {
     if (Horde_String::lower($this->_sqlType) == 'number' && $this->_precision == 1) {
         $this->_type = 'boolean';
         return;
     }
     parent::_setSimplifiedType();
 }
Example #2
0
 /**
  */
 protected function _setSimplifiedType()
 {
     if (strpos(Horde_String::lower($this->_sqlType), 'tinyint(1)') !== false) {
         $this->_type = 'boolean';
         return;
     } elseif (preg_match('/enum/i', $this->_sqlType)) {
         $this->_type = 'string';
         return;
     }
     parent::_setSimplifiedType();
 }
Example #3
0
 /**
  */
 protected function _setSimplifiedType()
 {
     switch (true) {
         case preg_match('/^(?:real|double precision)$/', $this->_sqlType):
             // Numeric and monetary types
             $this->_type = 'float';
             return;
         case preg_match('/^money$/', $this->_sqlType):
             // Monetary types
             $this->_type = 'decimal';
             return;
         case preg_match('/^(?:character varying|bpchar)(?:\\(\\d+\\))?$/', $this->_sqlType):
             // Character types
             $this->_type = 'string';
             return;
         case preg_match('/^bytea$/', $this->_sqlType):
             // Binary data types
             $this->_type = 'binary';
             return;
         case preg_match('/^timestamp with(?:out)? time zone$/', $this->_sqlType):
             // Date/time types
             $this->_type = 'datetime';
             return;
         case preg_match('/^interval$/', $this->_sqlType):
             $this->_type = 'string';
             return;
         case preg_match('/^(?:point|line|lseg|box|"?path"?|polygon|circle)$/', $this->_sqlType):
             // Geometric types
             $this->_type = 'string';
             return;
         case preg_match('/^(?:cidr|inet|macaddr)$/', $this->_sqlType):
             // Network address types
             $this->_type = 'string';
             return;
         case preg_match('/^bit(?: varying)?(?:\\(\\d+\\))?$/', $this->_sqlType):
             // Bit strings
             $this->_type = 'string';
             return;
         case preg_match('/^xml$/', $this->_sqlType):
             // XML type
             $this->_type = 'string';
             return;
         case preg_match('/^\\D+\\[\\]$/', $this->_sqlType):
             // Arrays
             $this->_type = 'string';
             return;
         case preg_match('/^oid$/', $this->_sqlType):
             // Object identifier types
             $this->_type = 'integer';
             return;
     }
     // Pass through all types that are not specific to PostgreSQL.
     parent::_setSimplifiedType();
 }