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
@@ -122,14 +122,30 @@ class oracle_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())) {
array_unshift($sqlarr, "TRUNCATE TABLE ". $this->getTableName($xmldb_table)); // oracle requires truncate before being able to drop a temp table
$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);
array_unshift($sqlarr, "TRUNCATE TABLE ". $this->getTableName($xmldb_table)); // oracle requires truncate before being able to drop a temp table
$this->temptables->delete_temptable($xmldb_table->getName());
return $sqlarr;
return $this->getDropTableSQL($xmldb_table);
}
/**