public function __construct(FluentPDO $fpdo, $table) { $clauses = array('DELETE FROM' => array($this, 'getClauseDeleteFrom'), 'DELETE' => array($this, 'getClauseDelete'), 'FROM' => null, 'JOIN' => array($this, 'getClauseJoin'), 'WHERE' => ' AND ', 'ORDER BY' => ', ', 'LIMIT' => null); parent::__construct($fpdo, $clauses); $this->statements['DELETE FROM'] = $table; $this->statements['DELETE'] = $table; }
/** * UpdateQuery constructor. * * @param FluentPDO $fpdo * @param $table */ public function __construct(FluentPDO $fpdo, $table) { $clauses = array('UPDATE' => array($this, 'getClauseUpdate'), 'JOIN' => array($this, 'getClauseJoin'), 'SET' => array($this, 'getClauseSet'), 'WHERE' => ' AND ', 'ORDER BY' => ', ', 'LIMIT' => null); parent::__construct($fpdo, $clauses); $this->statements['UPDATE'] = $table; $tableParts = explode(' ', $table); $this->joins[] = end($tableParts); }
function __construct(FluentPDO $fpdo, $from) { $clauses = array('SELECT' => ', ', 'FROM' => null, 'JOIN' => array($this, 'getClauseJoin'), 'WHERE' => ' AND ', 'GROUP BY' => ',', 'HAVING' => ' AND ', 'ORDER BY' => ', ', 'LIMIT' => null, 'OFFSET' => null, "\n--" => "\n--"); parent::__construct($fpdo, $clauses); # initialize statements $fromParts = explode(' ', $from); $this->fromTable = reset($fromParts); $this->fromAlias = end($fromParts); $this->statements['FROM'] = $from; $this->statements['SELECT'][] = $this->fromAlias . '.*'; $this->joins[] = $this->fromAlias; }