/**
  * Returns information about each field in the $table (quering the DBMS)
  * In a DBAL this should look up the right handler for the table and return compatible information
  * This function is important not only for the Install Tool but probably for
  * DBALs as well since they might need to look up table specific information
  * in order to construct correct queries. In such cases this information should
  * probably be cached for quick delivery.
  *
  * @param string $tableName Table name
  * @return array Field information in an associative array with fieldname => field row
  */
 public function admin_get_fields($tableName)
 {
     $output = array();
     // Do field mapping if needed:
     $ORIG_tableName = $tableName;
     if ($tableArray = $this->map_needMapping($tableName)) {
         // Table name:
         if ($this->mapping[$tableName]['mapTableName']) {
             $tableName = $this->mapping[$tableName]['mapTableName'];
         }
     }
     // Find columns
     $this->lastHandlerKey = $this->handler_getFromTableList($tableName);
     switch ((string) $this->handlerCfg[$this->lastHandlerKey]['type']) {
         case 'native':
             /** @var \mysqli_result $columns_res */
             $columns_res = $this->query('SHOW columns FROM ' . $tableName);
             while ($fieldRow = $columns_res->fetch_assoc()) {
                 $output[$fieldRow['Field']] = $fieldRow;
             }
             $columns_res->free();
             break;
         case 'adodb':
             $fieldRows = $this->handlerInstance[$this->lastHandlerKey]->MetaColumns($tableName, FALSE);
             if (is_array($fieldRows)) {
                 foreach ($fieldRows as $k => $fieldRow) {
                     settype($fieldRow, 'array');
                     $metaType = $this->getMetadata($fieldRow['type'], $tableName, $fieldRow['name']);
                     $output[$fieldRow['name']] = $this->dbmsSpecifics->transformFieldRowToMySQL($fieldRow, $metaType);
                 }
             }
             break;
         case 'userdefined':
             $output = $this->handlerInstance[$this->lastHandlerKey]->admin_get_fields($tableName);
             break;
     }
     // mapping should be done:
     if (is_array($tableArray) && is_array($this->mapping[$ORIG_tableName]['mapFieldNames'])) {
         $revFields = array_flip($this->mapping[$ORIG_tableName]['mapFieldNames']);
         $newOutput = array();
         foreach ($output as $fN => $fInfo) {
             if (isset($revFields[$fN])) {
                 $fN = $revFields[$fN];
                 $fInfo['Field'] = $fN;
             }
             $newOutput[$fN] = $fInfo;
         }
         $output = $newOutput;
     }
     return $output;
 }