/** * @return string */ public function prepareExists() { $columns = empty($this->_columns) ? '*' : implode(', ', $this->_columns); $tables = implode(', ', $this->_tables); $where = empty($this->_where) ? '' : ' WHERE ' . $this->_where->prepare(); $having = empty($this->_having) ? '' : ' HAVING ' . $this->_having->prepare(); $join = empty($this->_join) ? '' : ' ' . $this->_join->prepare(); $limit = ' LIMIT 0, 1'; $group = empty($this->_group) ? '' : ' GROUP BY ' . $this->_group; return 'SELECT ' . $columns . ' FROM ' . $tables . $join . $where . $group . $having . $limit; }
/** * @param SelectQuerySource $source source to which join operation should be applied * @param SqlJoinMethod $joinMethod method to use when performing join * @param SqlFieldArray $identicalColumns set of column names that should be used in joining */ function __construct(SelectQuerySource $source, SqlJoinMethod $joinMethod, SqlFieldArray $identicalColumns) { $this->identicalColumns = $identicalColumns; parent::__construct($source, $joinMethod); }
/** * @param SelectQuerySource $source source to which join operation should be applied * @param SqlJoinMethod $joinMethod method to use when performing join * @param IExpression $condition condition to use when performing join */ function __construct(SelectQuerySource $source, SqlJoinMethod $joinMethod, IExpression $condition) { $this->condition = $condition; parent::__construct($source, $joinMethod); }