class.ext_update.php
protected function renameDatabaseTableField($table, $oldFieldName, $newFieldName)
    {
        $title = 'Renaming "' . $table . ':' . $oldFieldName . '" to "' . $table . ':' . $newFieldName . '": ';

        $currentTableFields = $this->databaseConnection->admin_get_fields($table);

        if ($currentTableFields[$newFieldName]) {
            $message = 'Field ' . $table . ':' . $newFieldName . ' already existing.';
            $status = FlashMessage::OK;
        } else {
            if (!$currentTableFields[$oldFieldName]) {
                $message = 'Field ' . $table . ':' . $oldFieldName . ' not existing';
                $status = FlashMessage::ERROR;
            } else {
                $sql = 'ALTER TABLE ' . $table . ' CHANGE COLUMN ' . $oldFieldName . ' ' . $newFieldName . ' ' .
                    $currentTableFields[$oldFieldName]['Type'];

                if ($this->databaseConnection->admin_query($sql) === false) {
                    $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error();
                    $status = FlashMessage::ERROR;
                } else {
                    $message = 'OK!';
                    $status = FlashMessage::OK;
                }
            }
        }

        $this->addMessage($status, $title, $message);

        return $status;
    }
protected function renameDatabaseTableField($table, $oldFieldName, $newFieldName)
    {
        $title = 'Renaming "' . $table . ':' . $oldFieldName . '" to "' . $table . ':' . $newFieldName . '": ';

        $currentTableFields = $this->databaseConnection->admin_get_fields($table);

        if ($currentTableFields[$newFieldName]) {
            $message = 'Field ' . $table . ':' . $newFieldName . ' already existing.';
            $status = FlashMessage::OK;
        } else {
            if (!$currentTableFields[$oldFieldName]) {
                $message = 'Field ' . $table . ':' . $oldFieldName . ' not existing';
                $status = FlashMessage::ERROR;
            } else {
                $sql = 'ALTER TABLE ' . $table . ' CHANGE COLUMN ' . $oldFieldName . ' ' . $newFieldName . ' ' .
                    $currentTableFields[$oldFieldName]['Type'];

                if ($this->databaseConnection->admin_query($sql) === false) {
                    $message = ' SQL ERROR: ' . $this->databaseConnection->sql_error();
                    $status = FlashMessage::ERROR;
                } else {
                    $message = 'OK!';
                    $status = FlashMessage::OK;
                }
            }
        }

        $this->addMessage($status, $title, $message);

        return $status;
    }
protected function renameDatabaseTableField ( $ table , $ oldFieldName , $ newFieldName ) { $ title = 'Renaming "' . $ table . ':' . $ oldFieldName . '" to "' . $ table . ':' . $ newFieldName . '": ' ; $ currentTableFields = $ this -> databaseConnection -> admin_get_fields ( $ table ) ; if ( $ currentTableFields [ $ newFieldName ] ) { $ message = 'Field ' . $ table . ':' . $ newFieldName . ' already existing.' ; $ status = FlashMessage :: OK ; } else { if ( ! $ currentTableFields [ $ oldFieldName ] ) { $ message = 'Field ' . $ table . ':' . $ oldFieldName . ' not existing' ; $ status = FlashMessage :: ERROR ; } else { $ sql = 'ALTER TABLE ' . $ table . ' CHANGE COLUMN ' . $ oldFieldName . ' ' . $ newFieldName . ' ' . $ currentTableFields [ $ oldFieldName ] [ 'Type' ] ; if ( $ this -> databaseConnection -> admin_query ( $ sql ) === false ) { $ message = ' SQL ERROR: ' . $ this -> databaseConnection -> sql_error ( ) ; $ status = FlashMessage :: ERROR ; } else { $ message = 'OK!' ; $ status = FlashMessage :: OK ; } } } $ this -> addMessage ( $ status , $ title , $ message ) ; return $ status ; }
Renames a tabled field and does some plausibility checks.

@param  string $table
@param  string $oldFieldName
@param  string $newFieldName
@return int
Renames a tabled field and does some plausibility checks .