Example #1
0
 static function createFromDb(array $row)
 {
     $f = new self();
     $f->name = $row['Field'];
     @(list($type, $unsigned) = explode(' ', $row['Type'], 2));
     if ($unsigned == 'unsigned') {
         $f->unsigned = true;
     }
     @(list($f->type, $f->len) = preg_split('/[()]/', $type));
     if ($f->isInt()) {
         $f->len = null;
     }
     $f->null = $row['Null'] == 'YES' ? true : false;
     $f->default = strlen($row['Default']) ? $row['Default'] : null;
     $f->extra = strlen($row['Extra']) ? $row['Extra'] : null;
     return $f;
 }