mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-14974 improved columns caching implementation
This commit is contained in:
parent
aa07a81368
commit
a7544e377a
11 changed files with 36 additions and 44 deletions
|
@ -84,8 +84,6 @@ class database_manager {
|
|||
notify('<strong>' . get_string('error') . '</strong>');
|
||||
}
|
||||
|
||||
$this->mdb->reset_columns(); // Clear out the cache, just in case changes were made to table structures
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -150,8 +148,7 @@ class database_manager {
|
|||
}
|
||||
|
||||
/// Get list of fields in table
|
||||
$this->mdb->reset_columns($tablename); // better reset before testing
|
||||
$columns = $this->mdb->get_columns($tablename);
|
||||
$columns = $this->mdb->get_columns($tablename, false);
|
||||
|
||||
$exists = array_key_exists($fieldname, $columns);
|
||||
|
||||
|
|
|
@ -325,9 +325,7 @@ class mssql_sql_generator extends sql_generator {
|
|||
$fieldname = $xmldb_field->getName();
|
||||
|
||||
/// Take a look to field metadata
|
||||
$this->mdb->reset_columns($tablename);
|
||||
|
||||
$meta = $this->mdb->get_columns($tablename);
|
||||
$meta = $this->mdb->get_columns($tablename, false);
|
||||
$metac = $meta[$fieldname];
|
||||
$oldmetatype = $metac->meta_type;
|
||||
|
||||
|
|
|
@ -255,14 +255,10 @@ class mysql_sql_generator extends sql_generator {
|
|||
*/
|
||||
public function getCheckConstraintsFromDB($xmldb_table, $xmldb_field = null) {
|
||||
|
||||
global $db;
|
||||
|
||||
$tablename = $xmldb_table->getName($xmldb_table);
|
||||
|
||||
$this->mdb->reset_columns($tablename);
|
||||
|
||||
/// Fetch all the columns in the table
|
||||
if (!$columns = $this->mdb->get_columns($tablename)) {
|
||||
if (!$columns = $this->mdb->get_columns($tablename, false)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ class oracle_sql_generator extends sql_generator {
|
|||
$fieldname = $xmldb_field->getName();
|
||||
|
||||
/// Take a look to field metadata
|
||||
$meta = $this->mdb->get_columns($xmldb_table->getName());
|
||||
$meta = $this->mdb->get_columns($tablename, false);
|
||||
$metac = $meta[$fieldname];
|
||||
$oldmetatype = $metac->meta_type;
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ class postgres_sql_generator extends sql_generator {
|
|||
$fieldname = $xmldb_field->getName();
|
||||
|
||||
/// Take a look to field metadata
|
||||
$meta = $this->mdb->get_columns($xmldb_table->getName());
|
||||
$meta = $this->mdb->get_columns($tablename, false);
|
||||
$metac = $meta[$xmldb_field->getName()];
|
||||
$oldmetatype = $metac->meta_type;
|
||||
$oldlength = $metac->max_length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue