Renames a column.

@param string $oldName The current name of the column.
@param string $newName The new name of the column.
481877
public function renameColumn($oldName, $newName)
    {
        if (isset($this[$oldName])) {
            $this[$newName] = $this[$oldName];
        }

        // outside the if () since we want to delete nulled columns
        if ($this->offsetExists($oldName)) {
            unset($this[$oldName]);
        }
    }
328564
private function renameTable($old, $new) {
        $renameSql = 'alter table '.
            $this->prefixTable($old).
            ' rename to '.
            $this->prefixTable($new);
        $this->queryDefine($renameSql);
    }
629541
public synchronized void rename(String oldName, String newName) throws IOException {
        boolean touched = false;
        if (original != null) {
            if (original.getName().equals(oldName)) {
                original.setName(newName);
                touched = true;
            }
        }
        
        if (usages != null) {
            RangeSet r = usages.get(oldName);
            if (r != null) {
                usages.put(newName, r);
                usages.remove(oldName);
                touched = true;
            }
        }
        
        if (touched) {
            save();
        }
    }
515121
public function renameFolder($cb, $oldName, $newName)
    {
        $this->onResponse->push($cb);
        $this->writeln(self::TAG_RENAMEFOLDER . " RENAME "
            .$this->escapeString($oldName)." ".$this->escapeString($newName));
    }
510050
public function rename($path, $newPath)
    {
        try {
            return (bool) $this->api->rename($path, $newPath);
        } catch (\Exception $e) {
            return false;
        }
    }
1287456
public function renameColumn($oldName, $newName)
    {
        $action = RenameColumn::build($this->table, $oldName, $newName);
        $this->actions->addAction($action);

        return $this;
    }
1238925
public function renameColumn($name, $new_name)
    {
        $existing_columns = $this->getCols(true);
        // check if column is already existing
        if (!in_array($name, array_keys($existing_columns)))
            trigger_error('cannot rename column. it does not exist.',E_USER_ERROR);
        if (in_array($new_name, array_keys($existing_columns)))
            trigger_error('cannot rename column. new column already exist.',E_USER_ERROR);

        if (preg_match('/sqlite2?/', $this->db->driver()))
            // SQlite does not support drop or rename column directly
            $this->rebuild_cmd['rename'][$name] = $new_name;
        elseif (preg_match('/odbc/', $this->db->driver())) {
            // no rename column for odbc, create temp column
            $this->addColumn($new_name, $existing_columns[$name])->passThrough();
            $this->queries[] = "UPDATE $this->name SET $new_name = $name";
            $this->dropColumn($name);
        } else {
            $existing_columns = $this->getCols(true);
            $quotedTable = $this->db->quotekey($this->name);
            $quotedColumn = $this->db->quotekey($name);
            $quotedColumnNew = $this->db->quotekey($new_name);
            $cmd = array(
                'mysql' =>
                    "ALTER TABLE $quotedTable CHANGE $quotedColumn $quotedColumnNew ".$existing_columns[$name]['type'].";",
                'pgsql|ibm' =>
                    "ALTER TABLE $quotedTable RENAME COLUMN $quotedColumn TO $quotedColumnNew;",
                'mssql|sybase|dblib|sqlsrv' =>
                    "sp_rename [$this->name.$name], '$new_name', 'Column'",
            );
            if (preg_match('/mssql|sybase|dblib|sqlsrv/', $this->db->driver()))
                $this->suppress = true;
            $this->queries[] = $this->findQuery($cmd);
        }
    }
143460
public function RenameColumn($OldName, $NewName, $TableName = '') {
      if ($TableName != '')
         $this->_TableName = $TableName;

      // Get the schema for this table
      $OldPrefix = $this->Database->DatabasePrefix;
      $this->Database->DatabasePrefix = $this->_DatabasePrefix;
      $Schema = $this->Database->SQL()->FetchTableSchema($this->_TableName);
      $this->Database->DatabasePrefix = $OldPrefix;

      // Get the definition for this column
      $OldColumn = ArrayValue($OldName, $Schema);
      $NewColumn = ArrayValue($NewName, $Schema);

      // Make sure that one column, or the other exists
      if (!$OldColumn && !$NewColumn)
         throw new Exception(sprintf(T('The `%1$s` column does not exist.'),$OldName));

      // Make sure the new column name isn't already taken
      if ($OldColumn && $NewColumn)
         throw new Exception(sprintf(T('You cannot rename the `%1$s` column to `%2$s` because that column already exists.'), $OldName, $NewName));

      // Rename the column
      // The syntax for renaming a column is:
      // ALTER TABLE tablename CHANGE COLUMN oldname newname originaldefinition;
      if (!$this->Query('alter table `'.$this->_TableName.'` change column `'.$OldName.'` `'.$NewName.'` '.$this->_DefineColumn($OldColumn)))
         throw new Exception(sprintf(T('Failed to rename table `%1$s` to `%2$s`.'), $OldName, $NewName));

      return TRUE;
   }
1115646
public static function renameKey(array &$arr, $oldKey, $newKey): void
    {
        $offset = self::searchKey($arr, $oldKey);
        if ($offset !== null) {
            $keys = \array_keys($arr);
            $keys[$offset] = $newKey;
            $arr = \array_combine($keys, $arr);
        }
    }
912902
protected function renameFile($path, $newName)
    {
        $newPath = pathinfo($path, PATHINFO_DIRNAME) . '/' . $newName;

        try {
            $success = rename($path, $newPath);

            // @codeCoverageIgnoreStart
        } catch (\Exception $e) {
            throw new CouldNotRetrieveRemoteFileException("Failed to rename '{$path}' to '{$newName}'", $e->getCode(), $e);
            // @codeCoverageIgnoreEnd
        }

        // @codeCoverageIgnoreStart
        if ( ! $success) {
            throw new CouldNotRetrieveRemoteFileException("Failed to rename '{$path}' to '{$newName}'");
        }
        // @codeCoverageIgnoreEnd

        return $newPath;
    }
981620
protected function renameResult(array &$result, $old, $new)
    {

        // Check to see if the old item is there
        if (isset($result[$old])) {
            $result[$new] = $result[$old];
            unset($result[$old]);
        }
    }
929722
public function rename($oldname, $newname) {
		$this->connectIfNeeded();
		$this->handle->rename($oldname, $newname);
		$this->onFileRenamed(
			new Event(['sender' => $this, 'data' => [
				'oldname' => $oldname, 
				'newname' => $newname
			]])
		);
	}
777471
public function rename( string $old_name, string $new_name ): Prop
	{
		// check old
		$row = self::getEventItem($old_name);
		if( !$row )
		{
			throw new NotFoundException("Event '{$old_name}' not found");
		}

		$this->permissible($row->module_id, $old_name);

		// is update ?

		$prop = new Prop([
			"action" => "rename",
			"renamed" => false
		]);

		if( $old_name === $new_name )
		{
			return $prop;
		}

		// check new
		if( self::hasName($new_name) )
		{
			throw new \InvalidArgumentException("Duplicate event name '{$new_name}'");
		}

		if( ! $this->isValidModuleName($new_name) )
		{
			throw new \InvalidArgumentException("Invalid event name '{$new_name}' for the " . $this->getModule()->getName() . " module");
		}

		// dispatch event
		$event = new EventRenameDriverEvent($this, $old_name, $new_name);
		$dispatcher = EventManager::dispatcher($event->getName());
		$dispatcher->dispatch($event);

		$prop->set(
			"renamed",
			\DB::
				table("events")
					->whereId($row->id)
					->update(['name' => $new_name]) > 0
		);

		$prop->get("renamed") && $this->addLogDebug(Text::createInstance("The %s event is successfully renamed. New event name is %s", $old_name, $new_name));
		$dispatcher->complete($prop);
		return $prop;
	}
213223
public function rename($oldName, $newName) {
        if (false === @ftp_rename($this->getConnection(), $oldName, $newName)) {
            throw $this->newFTPException(sprintf("rename %s into %s failed", $oldName, $newName));
        }
        return $this;
    }
669213
public function renameColumn($oldName, $newName)
    {
        if (!$this->hasColumn($oldName)) {
            throw SchemaException::tableColumnDoesNotExist($this->getName(), $oldName);
        }

        if ($this->hasColumn($newName)) {
            throw SchemaException::tableColumnAlreadyExists($this->getName(), $newName);
        }

        $this->columns[$oldName]->setName($newName);
        $this->columns[$newName] = $this->columns[$oldName];
        unset($this->columns[$oldName]);
    }
118467
public function rename($newName, $returnNew = true)
    {
        $this->db->setQuery(
            SqlsrvGrammar::build(
                'exec sp_rename',
                $this->db->quoteName($this->getName()),
                ',',
                $this->db->quoteName($newName)
            )
        );

        $this->db->execute();

        if ($returnNew) {
            return $this->db->getTable($newName);
        }

        return $this;
    }
530890
public function renameTable($old, $new)
    {
        $this->append(sprintf('RENAME TABLE %s TO %s ', $this->quote($old), $this->quote($new)));
        return $this;
    }