Exemplo n.º 1
0
 /**
  * Given one correct xmldb_field and the new name, returns the SQL statements
  * to rename it (inside one array)
  * MSSQL is special, so we overload the function here. It needs to
  * drop the constraints BEFORE renaming the field
  */
 public function getRenameFieldSQL($xmldb_table, $xmldb_field, $newname)
 {
     $results = array();
     //Array where all the sentences will be stored
     /// Although this is checked in database_manager::rename_field() - double check
     /// that we aren't trying to rename one "id" field. Although it could be
     /// implemented (if adding the necessary code to rename sequences, defaults,
     /// triggers... and so on under each getRenameFieldExtraSQL() function, it's
     /// better to forbid it, mainly because this field is the default PK and
     /// in the future, a lot of FKs can be pointing here. So, this field, more
     /// or less, must be considered immutable!
     if ($xmldb_field->getName() == 'id') {
         return array();
     }
     /// Call to standard (parent) getRenameFieldSQL() function
     $results = array_merge($results, parent::getRenameFieldSQL($xmldb_table, $xmldb_field, $newname));
     return $results;
 }