Beispiel #1
0
 /**
  *
  * @param <type> $info
  */
 public function __construct(Webdb_DBMS_Table $table, $info)
 {
     $info = array_combine(array_map('strtolower', array_keys($info)), array_values($info));
     // Table object
     $this->_table = $table;
     // Name
     $this->_name = $info['field'];
     // Type
     $this->parse_type($info['type']);
     // Default
     $this->_default = $info['default'];
     // Primary key
     if (strtoupper($info['key']) == 'PRI') {
         $this->_isPK = true;
         if ($info['extra'] == 'auto_increment') {
             $this->_isAutoIncrement = true;
         }
     }
     // Unique key
     if (strtoupper($info['key']) == 'UNI') {
         $this->_isUnique = true;
     }
     // Comment
     $this->_comment = $info['comment'];
     // Collation
     $this->_collation = $info['collation'];
     // NULL?
     if ($info['null'] == 'NO') {
         $this->_required = TRUE;
     }
     // Is this a foreign key?
     if (in_array($this->_name, $table->get_foreign_key_names())) {
         $referencedTables = $table->get_referenced_tables();
         $this->_references = $referencedTables[$this->_name];
     }
     // DB user privileges
     $this->_db_user_privileges = $info['privileges'];
 }