* @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\builders; /** * This class implements the builder for index hint lists. * 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 IndexHintListBuilder implements Builder { public function hasHint($parsed) { return isset($parsed['hints']); } // TODO: the hint list should be enhanced to get base_expr fro position calculation public function build(array $parsed) { if (!isset($parsed['hints']) || $parsed['hints'] === false) { return ""; } $sql = ""; foreach ($parsed['hints'] as $k => $v) { $sql .= $v['hint_type'] . " " . $v['hint_list'] . " "; } return " " . substr($sql, 0, -1); } } ?>