MDL-22076 temptables - warn and dropped on disposal

This commit is contained in:
Eloy Lafuente
2010-04-21 16:12:27 +00:00
parent b944270f34
commit 10f375aa2e
13 changed files with 105 additions and 139 deletions
+21 -7
View File
@@ -54,13 +54,6 @@ class postgres_sql_generator extends sql_generator {
public $rename_key_sql = null; //SQL sentence to rename one key (PostgreSQL doesn't support this!)
//TABLENAME, OLDKEYNAME, NEWKEYNAME are dinamically replaced
/**
* Creates one new XMLDBpostgres7
*/
public function __construct($mdb) {
parent::__construct($mdb);
}
/**
* Reset a sequence to the id field of a table.
* @param string $table name of table or xmldb_table object
@@ -80,6 +73,27 @@ class postgres_sql_generator extends sql_generator {
return array("ALTER SEQUENCE $this->prefix{$tablename}_id_seq RESTART WITH $value");
}
/**
* Given one correct xmldb_table, returns the SQL statements
* to create temporary table (inside one array)
*/
public function getCreateTempTableSQL($xmldb_table) {
$this->temptables->add_temptable($xmldb_table->getName());
$sqlarr = $this->getCreateTableSQL($xmldb_table);
$sqlarr = preg_replace('/^CREATE TABLE/', "CREATE TEMPORARY TABLE", $sqlarr);
return $sqlarr;
}
/**
* Given one correct xmldb_table and the new name, returns the SQL statements
* to drop it (inside one array)
*/
public function getDropTempTableSQL($xmldb_table) {
$sqlarr = $this->getDropTableSQL($xmldb_table);
$this->temptables->delete_temptable($xmldb_table->getName());
return $sqlarr;
}
/**
* Given one XMLDB Type, lenght and decimals, returns the DB proper SQL type
*/