From 4a0d6ac4c249d8c02ada82105d36e635863d5e46 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Thu, 15 Aug 2024 06:53:50 +0000 Subject: [PATCH] + [misc] add getExpression. --- lib/sqlparser/sqlparser.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/sqlparser/sqlparser.class.php b/lib/sqlparser/sqlparser.class.php index d56d2abd6b..9f97c39552 100644 --- a/lib/sqlparser/sqlparser.class.php +++ b/lib/sqlparser/sqlparser.class.php @@ -129,6 +129,21 @@ class sqlparser return "$name($argStr)"; } + public function getExpression($table = null, $column = null, $alias = null, $function = null) + { + $expression = new PhpMyAdmin\SqlParser\Components\Expression(); + + if(!empty($function)) + { + $expression->function = $function; + $expression->expr = $this->getFunction($function, $expression->build($this->getExpression($table, $column))); + } + + $expression->alias = $alias; + + return $expression; + } + /** * Match columns with table. *