/** * @return string */ public function prepare() { $array = []; foreach ($this->_data as $key => $value) { $array[] = $key . '=' . $this->_connection->quote($value); } $where = empty($this->_where) ? '' : ' WHERE ' . $this->_where->prepare(); return 'UPDATE ' . $this->_tableName . ' SET ' . implode(', ', $array) . $where; }
/** * @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; }
/** * @return string */ public function prepare() { $where = empty($this->_where) ? '' : ' WHERE ' . $this->_where->prepare(); return 'DELETE FROM ' . $this->_tableName . $where; }