Added rename_field() support for MySQL

This commit is contained in:
stronk7
2006-10-01 22:44:39 +00:00
parent 01194b77ec
commit b5d61bfd9d
@@ -194,6 +194,24 @@ class XMLDBmysql extends XMLDBGenerator {
return $this->getAlterFieldSQL($xmldb_table, $xmldb_field);
}
/**
* Given one correct XMLDBField and the new name, returns the SQL statements
* to rename it (inside one array)
* MySQL is pretty diferent from the standard to justify this oveloading
*/
function getRenameFieldSQL($xmldb_table, $xmldb_field, $newname) {
$results = array(); //Array where all the sentences will be stored
/// Change the name of the field to perform the change
$xmldb_field->setName($xmldb_field->getName() . ' ' . $newname);
$results[] = 'ALTER TABLE ' . $this->getTableName($xmldb_table) . ' CHANGE ' .
$this->getFieldSQL($xmldb_field);
return $results;
}
/**
* Given one XMLDBTable and one XMLDBField, return the SQL statements needded to drop its default
* (usually invoked from getModifyDefaultSQL()