Skip to content

Commit

Permalink
Merge pull request #2213 from MGatner/list-tables-cached
Browse files Browse the repository at this point in the history
Filter listTables cache response on constrainPrefix
  • Loading branch information
lonnieezell authored Sep 17, 2019
2 parents f2bf43b + 8b539a6 commit 4684036
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,9 @@ public function listTables(bool $constrainByPrefix = false)
// Is there a cached result?
if (isset($this->dataCache['table_names']) && $this->dataCache['table_names'])
{
return $this->dataCache['table_names'];
return $constrainByPrefix ?
preg_grep("/^{$this->DBPrefix}/", $this->dataCache['table_names'])
: $this->dataCache['table_names'];
}

if (false === ($sql = $this->_listTables($constrainByPrefix)))
Expand Down

0 comments on commit 4684036

Please sign in to comment.