MDL-32029 fix get_tables() when prefix empty in external database

This commit is contained in:
Petr Skoda
2012-03-24 11:36:01 +01:00
parent c856a1f60b
commit 62cd8cd9f5
5 changed files with 25 additions and 14 deletions
+5 -3
View File
@@ -297,10 +297,12 @@ class pgsql_native_moodle_database extends moodle_database {
if ($result) {
while ($row = pg_fetch_row($result)) {
$tablename = reset($row);
if (strpos($tablename, $this->prefix) !== 0) {
continue;
if ($this->prefix !== '') {
if (strpos($tablename, $this->prefix) !== 0) {
continue;
}
$tablename = substr($tablename, strlen($this->prefix));
}
$tablename = substr($tablename, strlen($this->prefix));
$this->tables[$tablename] = $tablename;
}
pg_free_result($result);