+ [misc] add a part of getTables

This commit is contained in:
宋辰轩
2024-06-19 13:56:18 +08:00
committed by 綦新志
parent 0b19302ab5
commit f71e88860f
+17
View File
@@ -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);
}
}
}
}
/**