original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: 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
docstring_tokens: This function will rename the table passed as argument Before renaming the index the function will check it exists