Пример #1
0
 /**
  * Sets the proper column type
  * 
  * @param Column $column The column to asign the type
  * @param string $type   The string containing the SQLite type
  */
 protected function _setType(Column &$column, $type)
 {
     $type = str_replace(array('BIG', 'TINY', 'SMALL', 'MEDIUM', 'LONG'), '', $type);
     switch ($type) {
         case 'REAL':
             $column->setType(Column::TYPE_FLOAT);
             break;
         case 'INTEGER':
         case 'INT':
             $column->setType(Column::TYPE_INTEGER);
             break;
         case 'BLOB':
             $column->setType(Column::TYPE_BLOB);
             break;
         case 'VARCHAR':
             $column->setType(Column::TYPE_VARCHAR);
             break;
         case 'TEXT':
         default:
             $column->setType(Column::TYPE_TEXT);
     }
 }
Пример #2
0
 protected function _getColumnType(Column $col)
 {
     switch ($col->getType()) {
         case Column::TYPE_INTEGER:
             $type = $this->_checkSize($col, 'INT');
             break;
         case Column::TYPE_BLOB:
             $type = $this->_checkSize($col, 'BLOB');
             break;
         case Column::TYPE_TEXT:
             $type = $this->_checkSize($col, 'TEXT');
             break;
         case Column::TYPE_DATETIME:
             $type = 'DATETIME';
             break;
         case Column::TYPE_BOOLEAN:
             $type = 'BOOLEAN';
             break;
         case Column::TYPE_FLOAT:
             $type = 'FLOAT';
             break;
         case Column::TYPE_VARCHAR:
             $type = "VARCHAR({$col->length})";
             break;
     }
     return $type;
 }