* @copyright 2010-2014 Justin Swanhart and André Rothe * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) * @version SVN: $Id: IndexColumnBuilder.php 917 2014-01-08 11:47:42Z phosco@gmx.de $ * */ require_once dirname(__FILE__) . '/../exceptions/UnsupportedFeatureException.php'; require_once dirname(__FILE__) . '/../utils/ExpressionType.php'; /** * This class implements the builder for index column entries of the column-list * parts of CREATE TABLE. * 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 IndexColumnBuilder { protected function buildLength($parsed) { return ($parsed === false ? '' : ('(' . $parsed . ')')); } protected function buildDirection($parsed) { return ($parsed === false ? '' : (' ' . $parsed)); } public function build($parsed) { if ($parsed['expr_type'] !== ExpressionType::INDEX_COLUMN) { return ""; } $sql = $parsed['name']; $sql .= $this->buildLength($parsed['length']); $sql .= $this->buildDirection($parsed['dir']); return $sql; } } ?>