* @copyright 2010-2014 Justin Swanhart and André Rothe * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) * @version SVN: $Id: UpdateStatementBuilder.php 830 2013-12-18 09:35:42Z phosco@gmx.de $ * */ require_once dirname(__FILE__) . '/WhereBuilder.php'; require_once dirname(__FILE__) . '/SetBuilder.php'; require_once dirname(__FILE__) . '/UpdateBuilder.php'; /** * This class implements the builder for the whole Update 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 UpdateStatementBuilder { protected function buildWHERE($parsed) { $builder = new WhereBuilder(); return $builder->build($parsed); } protected function buildSET($parsed) { $builder = new SetBuilder(); return $builder->build($parsed); } protected function buildUPDATE($parsed) { $builder = new UpdateBuilder(); return $builder->build($parsed); } public function build($parsed) { $sql = $this->buildUPDATE($parsed['UPDATE']) . " " . $this->buildSET($parsed['SET']); if (isset($parsed['WHERE'])) { $sql .= " " . $this->buildWHERE($parsed['WHERE']); } return $sql; } } ?>