diff --git a/module/bi/model.php b/module/bi/model.php index b83138f055..f99eea90cd 100644 --- a/module/bi/model.php +++ b/module/bi/model.php @@ -52,6 +52,23 @@ class biModel extends model */ public function getTables(object $statement, bool $deep = false) { + $tables = array(); + if($statement->from) + { + foreach($statement->from as $fromInfo) + { + if($fromInfo->table) + { + $tables[] = $fromInfo->table; + } + elseif($deep && $fromInfo->subquery) + { + $parser = new sqlparser($fromInfo->expr); + $subTables = $this->getTables($parser->statements[0], true); + $tables = array_merge($tables, $subTables); + } + } + } } /**