readTableParameters() public method

Read additional table parameters
public readTableParameters ( string $name ) : array
$name string The table name to read.
return array
 /**
  * testReadTableParameters method
  *
  * @access public
  * @return void
  */
 function testReadTableParameters()
 {
     $this->Dbo->cacheSources = $this->Dbo->testing = false;
     $tableName = 'tinyint_' . uniqid();
     $this->Dbo->rawQuery('CREATE TABLE ' . $this->Dbo->fullTableName($tableName) . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;');
     $result = $this->Dbo->readTableParameters($tableName);
     $this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
     $expected = array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB');
     $this->assertEqual($result, $expected);
     $this->Dbo->rawQuery('CREATE TABLE ' . $this->Dbo->fullTableName($tableName) . ' (id int(11) AUTO_INCREMENT, bool tinyint(1), small_int tinyint(2), primary key(id)) ENGINE=MyISAM DEFAULT CHARSET=cp1250 COLLATE=cp1250_general_ci;');
     $result = $this->Dbo->readTableParameters($tableName);
     $this->Dbo->rawQuery('DROP TABLE ' . $this->Dbo->fullTableName($tableName));
     $expected = array('charset' => 'cp1250', 'collate' => 'cp1250_general_ci', 'engine' => 'MyISAM');
     $this->assertEqual($result, $expected);
 }
 /**
  * Alter Table method
  *
  * @param string $type Type of operation to be done
  * @param array $tables List of tables and fields
  * @return bool Return true in case of success, otherwise false
  * @throws MigrationException
  */
 protected function _alterTable($type, $tables)
 {
     foreach ($tables as $table => $fields) {
         $indexes = array();
         if (isset($fields['indexes'])) {
             $indexes = $fields['indexes'];
             unset($fields['indexes']);
         }
         if ($type === 'drop') {
             $this->_alterIndexes($indexes, $type, $table);
         }
         foreach ($fields as $field => $col) {
             $model = new Model(array('table' => $table, 'ds' => $this->connection));
             $tableFields = $this->db->describe($model);
             $tableFields['indexes'] = $this->db->index($model);
             $tableFields['tableParameters'] = $this->db->readTableParameters($this->db->fullTableName($model, false, false));
             if ($type === 'drop') {
                 $field = $col;
             }
             if ($type === 'rename') {
                 $data = array('table' => $table, 'old_name' => $field, 'new_name' => $col);
             } else {
                 $data = array('table' => $table, 'field' => $field);
             }
             $callbackData = $data;
             if ($this->_invokePrecheck('beforeAction', $type . '_field', $data)) {
                 switch ($type) {
                     case 'add':
                         $sql = $this->db->alterSchema(array($table => array('add' => array($field => $col))));
                         break;
                     case 'drop':
                         $sql = $this->db->alterSchema(array($table => array('drop' => array($field => array()))));
                         break;
                     case 'change':
                         if (!isset($col['type']) || $col['type'] == $tableFields[$field]['type']) {
                             $def = array_merge($tableFields[$field], $col);
                         } else {
                             $def = $col;
                         }
                         if (!empty($def['length']) && !empty($col['type']) && (substr($col['type'], 0, 4) === 'date' || substr($col['type'], 0, 4) === 'time')) {
                             $def['length'] = null;
                         }
                         $sql = $this->db->alterSchema(array($table => array('change' => array($field => $def))));
                         break;
                     case 'rename':
                         $data = array();
                         if (array_key_exists($field, $tableFields)) {
                             $data = $tableFields[$field];
                         }
                         $sql = $this->db->alterSchema(array($table => array('change' => array($field => array_merge($data, array('name' => $col))))));
                         break;
                 }
                 if ($this->dry) {
                     $this->logQuery($sql);
                     continue;
                 }
                 $this->_invokeCallbacks('beforeAction', $type . '_field', $callbackData);
                 if (@$this->db->execute($sql) === false) {
                     throw new MigrationException($this, sprintf(__d('migrations', 'SQL Error: %s'), $this->db->error));
                 }
                 $this->_invokeCallbacks('afterAction', $type . '_field', $callbackData);
             }
         }
         if ($type !== 'drop') {
             $this->_alterIndexes($indexes, $type, $table);
         }
     }
     return true;
 }