Skip to content

Commit

Permalink
MDL-17377 DML: prefixless database regression in new native drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Nov 24, 2008
1 parent e494fbf commit 7fdcb77
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/dml/mysqli_native_moodle_database.php
Expand Up @@ -156,10 +156,12 @@ public function get_tables() {
if ($result) {
while ($arr = $result->fetch_assoc()) {
$tablename = reset($arr);
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));
$tables[$tablename] = $tablename;
}
$result->close();
Expand All @@ -172,7 +174,6 @@ public function get_tables() {
* @return array of arrays
*/
public function get_indexes($table) {
$preflen = strlen($this->prefix);
$indexes = array();
$sql = "SHOW INDEXES FROM {$this->prefix}$table";
$this->query_start($sql, null, SQL_QUERY_AUX);
Expand Down

0 comments on commit 7fdcb77

Please sign in to comment.