MDL-16483 Reverting as Petr ordered... I mean, suggested.

This commit is contained in:
nicolasconnault 2008-09-16 14:35:15 +00:00
parent abcd0fc53e
commit ba14791091
3 changed files with 7 additions and 15 deletions

View File

@ -93,18 +93,14 @@ abstract class adodb_moodle_database extends moodle_database {
* Return tables in database WITHOUT current prefix
* @return array of table names in lowercase and without prefix
*/
public function get_tables($prefix=null) {
public function get_tables() {
$metatables = $this->adodb->MetaTables();
$tables = array();
if (is_null($prefix)) {
$prefix = $this->prefix;
}
foreach ($metatables as $table) {
$table = strtolower($table);
if (empty($prefix) || strpos($table, $prefix) === 0) {
$tablename = substr($table, strlen($prefix));
if (empty($this->prefix) || strpos($table, $this->prefix) === 0) {
$tablename = substr($table, strlen($this->prefix));
$tables[$tablename] = $tablename;
}
}

View File

@ -438,7 +438,7 @@ abstract class moodle_database {
* Return tables in database WITHOUT current prefix
* @return array of table names in lowercase and without prefix
*/
public abstract function get_tables($prefix=null);
public abstract function get_tables();
/**
* Return table indexes - everything lowercased

View File

@ -108,13 +108,9 @@ class sqlite3_pdo_moodle_database extends pdo_moodle_database {
* Return tables in database WITHOUT current prefix
* @return array of table names in lowercase and without prefix
*/
public function get_tables($prefix=null) {
public function get_tables() {
$tables = array();
if (is_null($prefix)) {
$prefix = $this->prefix;
}
$sql = 'SELECT name FROM sqlite_master WHERE type="table" UNION ALL SELECT name FROM sqlite_temp_master WHERE type="table" ORDER BY name';
if ($this->debug) {
$this->debug_query($sql);
@ -123,8 +119,8 @@ class sqlite3_pdo_moodle_database extends pdo_moodle_database {
foreach ($rstables as $table) {
$table = $table['name'];
$table = strtolower($table);
if (empty($prefix) || strpos($table, $prefix) === 0) {
$table = substr($table, strlen($prefix));
if (empty($this->prefix) || strpos($table, $this->prefix) === 0) {
$table = substr($table, strlen($this->prefix));
$tables[$table] = $table;
}
}