original_string: public function rename_field(xmldb_table $xmldb_table, xmldb_field $xmldb_field, $newname) {
          if (empty($newname)) {
              throw new ddl_exception('ddlunknownerror', null, 'newname can not be empty');
          }
  
          if (!$this->table_exists($xmldb_table)) {
              throw new ddl_table_missing_exception($xmldb_table->getName());
          }
  
          // Check the field exists
          if (!$this->field_exists($xmldb_table, $xmldb_field)) {
              throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName());
          }
  
          // Check we have included full field specs
          if (!$xmldb_field->getType()) {
              throw new ddl_exception('ddlunknownerror', null,
                        'Field ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
                        ' must contain full specs. Rename skipped');
          }
  
          // Check field isn't id. Renaming over that field is not allowed
          if ($xmldb_field->getName() == 'id') {
              throw new ddl_exception('ddlunknownerror', null,
                        'Field ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
                        ' cannot be renamed. Rename skipped');
          }
  
          if (!$sqlarr = $this->generator->getRenameFieldSQL($xmldb_table, $xmldb_field, $newname)) {
              return; //Empty array = nothing to do = no error
          }
  
          $this->execute_sql_arr($sqlarr, array($xmldb_table->getName()));
      }
code: public function rename_field(xmldb_table $xmldb_table, xmldb_field $xmldb_field, $newname) {
          if (empty($newname)) {
              throw new ddl_exception('ddlunknownerror', null, 'newname can not be empty');
          }
  
          if (!$this->table_exists($xmldb_table)) {
              throw new ddl_table_missing_exception($xmldb_table->getName());
          }
  
          // Check the field exists
          if (!$this->field_exists($xmldb_table, $xmldb_field)) {
              throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName());
          }
  
          // Check we have included full field specs
          if (!$xmldb_field->getType()) {
              throw new ddl_exception('ddlunknownerror', null,
                        'Field ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
                        ' must contain full specs. Rename skipped');
          }
  
          // Check field isn't id. Renaming over that field is not allowed
          if ($xmldb_field->getName() == 'id') {
              throw new ddl_exception('ddlunknownerror', null,
                        'Field ' . $xmldb_table->getName() . '->' . $xmldb_field->getName() .
                        ' cannot be renamed. Rename skipped');
          }
  
          if (!$sqlarr = $this->generator->getRenameFieldSQL($xmldb_table, $xmldb_field, $newname)) {
              return; //Empty array = nothing to do = no error
          }
  
          $this->execute_sql_arr($sqlarr, array($xmldb_table->getName()));
      }
code_tokens: public function rename_field ( xmldb_table $ xmldb_table , xmldb_field $ xmldb_field , $ newname ) { if ( empty ( $ newname ) ) { throw new ddl_exception ( 'ddlunknownerror' , null , 'newname can not be empty' ) ; } if ( ! $ this -> table_exists ( $ xmldb_table ) ) { throw new ddl_table_missing_exception ( $ xmldb_table -> getName ( ) ) ; } // Check the field exists if ( ! $ this -> field_exists ( $ xmldb_table , $ xmldb_field ) ) { throw new ddl_field_missing_exception ( $ xmldb_field -> getName ( ) , $ xmldb_table -> getName ( ) ) ; } // Check we have included full field specs if ( ! $ xmldb_field -> getType ( ) ) { throw new ddl_exception ( 'ddlunknownerror' , null , 'Field ' . $ xmldb_table -> getName ( ) . '->' . $ xmldb_field -> getName ( ) . ' must contain full specs. Rename skipped' ) ; } // Check field isn't id. Renaming over that field is not allowed if ( $ xmldb_field -> getName ( ) == 'id' ) { throw new ddl_exception ( 'ddlunknownerror' , null , 'Field ' . $ xmldb_table -> getName ( ) . '->' . $ xmldb_field -> getName ( ) . ' cannot be renamed. Rename skipped' ) ; } if ( ! $ sqlarr = $ this -> generator -> getRenameFieldSQL ( $ xmldb_table , $ xmldb_field , $ newname ) ) { return ; //Empty array = nothing to do = no error } $ this -> execute_sql_arr ( $ sqlarr , array ( $ xmldb_table -> getName ( ) ) ) ; }
docstring: This function will rename the field in the table passed as arguments
  Before renaming the field, the function will check it exists
  
  @param xmldb_table $xmldb_table Table object (just the name is mandatory).
  @param xmldb_field $xmldb_field Index object (full specs are required).
  @param string $newname New name of the field.
  @return void
docstring_tokens: This function will rename the field in the table passed as arguments Before renaming the field the function will check it exists