public function rename_restricted_columns() { $sql = sprintf("SHOW COLUMNS FROM `%s`", $this->name); $z = mysql_query($sql); while ($r = mysql_fetch_array($z)) { $tc = TableColumn::from_mysql_result($r); if (in_array($tc->name, TableColumn::$restricted_names)) { $i = 1; $sql = ""; do { $new_name = $tc->name . "_" . $i; $sql = sprintf("ALTER TABLE `%s` CHANGE COLUMN `%s` `%s` %s", $this->name, $tc->name, $new_name, $tc->get_definition()); $i++; } while (!mysql_query($sql)); } } return 0; }