mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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
|
@ -9,6 +9,8 @@ abstract class moodle_database {
|
|||
// manipulates the db structure
|
||||
protected $database_manager;
|
||||
|
||||
protected $columns = array(); // I wish we had a shared memory cache for this :-(
|
||||
|
||||
// db connection options
|
||||
protected $dbhost;
|
||||
protected $dbuser;
|
||||
|
@ -319,16 +321,19 @@ abstract class moodle_database {
|
|||
/**
|
||||
* Returns datailed information about columns in table. This information is cached internally.
|
||||
* @param string $table name
|
||||
* @param bool $usecache
|
||||
* @return array array of database_column_info objects indexed with column names
|
||||
*/
|
||||
public abstract function get_columns($table);
|
||||
public abstract function get_columns($table, $usecache=true);
|
||||
|
||||
/**
|
||||
* Reset internal column details cache
|
||||
* @param string $table - empty means all, or one if name of table given
|
||||
* @return void
|
||||
*/
|
||||
public abstract function reset_columns($table=null);
|
||||
public function reset_columns() {
|
||||
$this->columns[] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns sql generator used for db manipulation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue