From 08959ef886cf9cbc70ba54ebd1512ddac45020c0 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Tue, 11 Jun 2024 03:08:04 +0000 Subject: [PATCH] + [misc] add parseTables. --- lib/sqlparser/sqlparser.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/sqlparser/sqlparser.class.php b/lib/sqlparser/sqlparser.class.php index 1d1007006d..f671e68e50 100644 --- a/lib/sqlparser/sqlparser.class.php +++ b/lib/sqlparser/sqlparser.class.php @@ -71,6 +71,25 @@ class sqlparser $this->isSelect = $this->statement instanceof PhpMyAdmin\SqlParser\Statements\SelectStatement === true; } + /** + * Parse tables. + * + * @access public + * @return void + */ + public function parseTables() + { + $from = current($this->statement->from); + $joins = $this->statement->join; + + $tables = array(); + $tables[] = $this->parseTable($from, 'from'); + + foreach($joins as $join) $tables[] = $this->parseTable($join->expr, 'join'); + + return $tables; + } + /** * Parse table. *