* @copyright 2010-2014 Justin Swanhart and André Rothe * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) * @version SVN: $Id$ * */ namespace PHPSQLParser\processors; use PHPSQLParser\utils\ExpressionType; /** * This class implements the processor for the HAVING statement. * You can overwrite all functions to achieve another handling. * * @author André Rothe * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) * */ class HavingProcessor extends ExpressionListProcessor { public function process($tokens, $select = array()) { $parsed = parent::process($tokens); foreach ($parsed as $k => $v) { if ($v['expr_type'] === ExpressionType::COLREF) { foreach ($select as $clause) { if (!isset($clause['alias'])) { continue; } if (!$clause['alias']) { continue; } if ($clause['alias']['no_quotes'] === $v['no_quotes']) { $parsed[$k]['expr_type'] = ExpressionType::ALIAS; break; } } } } return $parsed; } } ?>