This function will rename the table passed as argument
Before renaming the index, the function will check it exists

@param xmldb_table $xmldb_table Table object (just the name is mandatory).
@param string $newname New name of the index.
@return void
15328
public function rename_table(xmldb_table $xmldb_table, $newname) {
        // Check newname isn't empty
        if (!$newname) {
            throw new ddl_exception('ddlunknownerror', null, 'newname can not be empty');
        }

        $check = new xmldb_table($newname);

        // Check table already renamed
        if (!$this->table_exists($xmldb_table)) {
            if ($this->table_exists($check)) {
                throw new ddl_exception('ddlunknownerror', null, 'table probably already renamed');
            } else {
                throw new ddl_table_missing_exception($xmldb_table->getName());
            }
        }

        // Check new table doesn't exist
        if ($this->table_exists($check)) {
            throw new ddl_exception('ddltablealreadyexists', $check->getName(), 'can not rename table');
        }

        if (!$sqlarr = $this->generator->getRenameTableSQL($xmldb_table, $newname)) {
            throw new ddl_exception('ddlunknownerror', null, 'table rename sql not generated');
        }

        $this->execute_sql_arr($sqlarr);
    }
1111870
function(xmlElement) {
    var name = xmlElement.getAttribute('name');
    this.renameProcedure(this.getProcedureCall(), name);
    var args = [];
    var paramIds = [];
    for (var i = 0, childNode; childNode = xmlElement.childNodes[i]; i++) {
      if (childNode.nodeName.toLowerCase() == 'arg') {
        args.push(childNode.getAttribute('name'));
        paramIds.push(childNode.getAttribute('paramId'));
      }
    }
    this.setProcedureParameters_(args, paramIds);
  }
47328
public function getRenameKeySQL($xmldb_table, $xmldb_key, $newname) {
        $xmldb_table->deleteKey($xmldb_key->getName());
        $xmldb_key->setName($newname);
        $xmldb_table->addkey($xmldb_key);
        return $this->getAlterTableSchema($xmldb_table);
    }
1033655
public function renameView($oldName, $newName)
    {
        if (!$this->hasView($oldName)) {
            throw SchemaException::schemaViewDoesNotExist($this->getName(), $oldName);
        }

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

        $this->views[$oldName]->setName($newName);
        $this->views[$newName] = $this->views[$oldName];

        unset($this->views[$oldName]);
    }
573868
private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable)
    {
        if (!oldTable.isIndexed()) {
            return;
        }

        if (!tableManager.exists(oldTable.getIndexTableName())) {
            throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getIndexTableName()));
        }

        if (tableManager.exists(newTable.getIndexTableName())) {
            throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getIndexTableName()));
        }

        if (!tableManager.exists(oldTable.getMetricsTableName())) {
            throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getMetricsTableName()));
        }

        if (tableManager.exists(newTable.getMetricsTableName())) {
            throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getMetricsTableName()));
        }

        tableManager.renameAccumuloTable(oldTable.getIndexTableName(), newTable.getIndexTableName());
        tableManager.renameAccumuloTable(oldTable.getMetricsTableName(), newTable.getMetricsTableName());
    }
71707
public function rename($old_name = null, $new_name = null)
    {
        if (\ftp_rename($this->_stream, $old_name, $new_name)) {
            return true;
        }

        $this->error = 'Failed to rename file "'.$old_name.'"';

        return false;
    }
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);
        }
    }
746262
public function renameSequence($oldName, $newName)
    {
        if (!$this->hasSequence($oldName)) {
            throw SchemaException::schemaSequenceDoesNotExist($this->getName(), $oldName);
        }

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

        $this->sequences[$oldName]->setName($newName);
        $this->sequences[$newName] = $this->sequences[$oldName];

        unset($this->sequences[$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;
    }
1238959
public function renameColumn($old, $new)
    {
        $this->append(sprintf(' RENAME COLUMN %s TO %s ', $this->quote($old), $this->quote($new)));
        return $this;
    }
725718
public function renameForeignKey($oldName, $newName)
    {
        if (!$this->hasForeignKey($oldName)) {
            throw SchemaException::tableForeignKeyDoesNotExist($this->getName(), $oldName);
        }

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

        $this->foreignKeys[$oldName]->setName($newName);
        $this->foreignKeys[$newName] = $this->foreignKeys[$oldName];
        unset($this->foreignKeys[$oldName]);
    }
700549
public static function rename($oldName, $newName, $context = null)
    {
        return self::resourceExists($oldName) ? rename($oldName, $newName, $context) : false;
    }
180168
public function rename($newName, $returnNew = true)
    {
        if ($this->db->getDatabase()->getName() == $this->getName()) {
            $this->db->disconnect();
            $this->db->setDatabaseName(null);
        }

        $pid = version_compare($this->db->getVersion(), '9.2', '>=') ? 'pid' : 'procpid';

        $query = $this->db->getQuery(true);

        $query->select('pg_terminate_backend(' . $pid . ')')
            ->from('pg_stat_activity')
            ->where('datname = ' . $query->quote($this->getName()));

        $this->db->setQuery($query)->execute();

        $query = sprintf(
            'ALTER DATABASE %s RENAME TO %s',
            $this->db->quoteName($this->getName()),
            $this->db->quoteName($newName)
        );

        $this->db->setQuery($query)->execute();

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

        return $this;
    }
1222591
public function rename($newpath)
    {
        if ($this->filesystem->rename($this->path, $newpath)) {
            $this->path = $newpath;

            return true;
        }

        return false;
    }
555001
public function rename($oldname, $newname)
    {
        $this->copy($oldname, $newname);

        // Delete the original object
        if ($this->isDir($oldname))
        {
            $this->deleteFolder($oldname);
        } else {
            $this->delete($oldname);
        }

        return true;
    }
744941
public static function renameColumn(string $table, string $oldColumn, string $newColumn): string
    {
        $query = self::getQuery(true);

        return (string) $query->element(
            'exec sp_rename',
            $query->quote([
                $table . '.' . $oldColumn,
                $newColumn,
                'COLUMN'
            ])
        );
    }
261468
public boolean renameTable(String tableName, String newTableName) throws DBException
    {
        try {
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
            if (this.getStatement(DBConstants.SQL_CREATE_TYPE) == null)
            	this.setStatement(((JdbcDatabase)this.getDatabase()).getJDBCConnection().createStatement(), DBConstants.SQL_CREATE_TYPE);

            String sql = "RENAME TABLE " + tableName + " TO " + newTableName;
            this.getStatement(DBConstants.SQL_CREATE_TYPE).execute(sql);
            
            if (DBConstants.TRUE.equals((String)this.getDatabase().getProperties().get(SQLParams.NO_PREPARED_STATEMENTS_ON_CREATE)))
                this.setStatement(null, DBConstants.SQL_CREATE_TYPE);
        } catch (SQLException e) {
            throw this.getDatabase().convertError(e);
        }
        return true;
    }