From 93ba76eee4a766ac35567f5eea65a9c2eba4b066 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Fri, 16 Aug 2024 06:34:26 +0000 Subject: [PATCH] * [misc] add addSelect. --- lib/sqlparser/sqlparser.class.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/sqlparser/sqlparser.class.php b/lib/sqlparser/sqlparser.class.php index f739a00df5..03f9ec63c2 100644 --- a/lib/sqlparser/sqlparser.class.php +++ b/lib/sqlparser/sqlparser.class.php @@ -137,6 +137,26 @@ class sqlparser $this->statement->from = array($from); } + /** + * Add select. + * + * @param array|object $exprs + * @access public + * @return void + */ + public function addSelect($exprs) + { + if(empty($exprs)) return; + + if($exprs instanceof PhpMyAdmin\SqlParser\Components\Expression) + { + $this->statement->expr[] = $exprs; + return; + } + + foreach($exprs as $expr) $this->addSelect($expr); + } + /** * Get function. *