MDL-32434 allow database_manager->drop_table() for temporary tables

This commit is contained in:
Petr Skoda
2012-04-13 16:58:17 +02:00
parent 668a499d89
commit 9b3323b8be
5 changed files with 91 additions and 18 deletions
+21 -5
View File
@@ -134,14 +134,30 @@ class mysql_sql_generator extends sql_generator {
}
/**
* Given one correct xmldb_table and the new name, returns the SQL statements
* Given one correct xmldb_table, returns the SQL statements
* to drop it (inside one array).
*
* @param xmldb_table $xmldb_table The table to drop.
* @return array SQL statement(s) for dropping the specified table.
*/
public function getDropTableSQL($xmldb_table) {
$sqlarr = parent::getDropTableSQL($xmldb_table);
if ($this->temptables->is_temptable($xmldb_table->getName())) {
$sqlarr = preg_replace('/^DROP TABLE/', "DROP TEMPORARY TABLE", $sqlarr);
$this->temptables->delete_temptable($xmldb_table->getName());
}
return $sqlarr;
}
/**
* Given one correct xmldb_table, returns the SQL statements
* to drop it (inside one array)
*
* @param xmldb_table $xmldb_table The table to drop.
* @return array SQL statement(s) for dropping the specified table.
*/
public function getDropTempTableSQL($xmldb_table) {
$sqlarr = $this->getDropTableSQL($xmldb_table);
$sqlarr = preg_replace('/^DROP TABLE/', "DROP TEMPORARY TABLE", $sqlarr);
$this->temptables->delete_temptable($xmldb_table->getName());
return $sqlarr;
return $this->getDropTableSQL($xmldb_table);
}
/**