get query parts like SELECT, FROM and WHERE for MySQL-Query

@return array Array containing the query parts for MySQL
489987
public function getQueryParts()
    {
        $fields = 'SQL_CALC_FOUND_ROWS *';
        $table = $this->table;
        $where = '1=1';

        // if a searchword was given, calculate percent of score
        if ($this->pObj->sword) {
            $fields .= ', MATCH (title, content) AGAINST ("'
                . $this->pObj->scoreAgainst
                . '") + ('
                . $this->pObj->extConf['multiplyValueToTitle']
                . ' * MATCH (title) AGAINST ("'
                . $this->pObj->scoreAgainst
                . '")) AS score';
        }

        // add where clause
        $where .= $this->getWhere();

        // add ordering
        $orderBy = $this->getOrdering();

        // add limitation
        $limit = $this->getLimit();

        $queryParts = array(
            'SELECT' => $fields,
            'FROM' => $table,
            'WHERE' => $where,
            'GROUPBY' => '',
            'ORDERBY' => $orderBy,
            'LIMIT' => $limit[0] . ',' . $limit[1]
        );

        // hook for third party applications to manipulate last part of query building
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getQueryParts'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['getQueryParts'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $queryParts = $_procObj->getQueryParts($queryParts, $this);
            }
        }

        return $queryParts;
    }
1041075
public function getQueryAsArray()
        {
            $query = $this->getQuery();
            $querryArray = array();

            if ($query !== false) {
                parse_str($query, $querryArray);
            }

            return $querryArray;
        }
446785
public function getQuery()
    {
        $sql = $this->prepareSelectString();
        $sql .= $this->prepareJoinString();
        $sql .= $this->prepareWhereString();
        $sql .= $this->prepareGroupByString();
        $sql .= $this->prepareHavingString();
        $sql .= $this->prepareOrderByString();
        $sql .= $this->prepareLimitString();

        return $sql;
    }
478302
protected function whereStatement(): array
    {
        return [
            $this->key(Record::OUTER_KEY) => $this->parent->getField($this->key(Record::INNER_KEY))
        ];
    }
855363
public function getAll()
    {
        $sql = "SELECT * FROM `$this->_table`";
        $this->__init_database();

        if ($stmt = $this->db->prepare($sql)) return $this;

        $this->result = $stmt->fetchAll(MySQL::FETCH_OBJ);

        return $this;
    }
95986
protected function whereChildSql() {
        $this->params = [];
        $sql = $this->parseWhere($this->wheres, $this->params);
        return $sql;
    }
385474
public function getQueryParams() : array
    {
        $this->queryStrings->usePercentEncode(false);
        $r = $this->queryStrings->toArray(true);
        $this->queryStrings->usePercentEncode(true);

        return $r;
    }
971421
protected function _getQuery()
    {
        $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
        $oCat->setLanguage(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('editlanguage'));

        $sCategoriesTable = $oCat->getViewName();

        return " from $sCategoriesTable where " . $oCat->getSqlActiveSnippet();
    }
1122376
public function get_query()
	{
		// Get the columns
		$columns = $this->select(false);

		// Start building the query
		$select = $columns;
		if ($this->use_subquery())
		{
			$select = array();
			foreach ($columns as $c)
			{
				$select[] = $c[0];
			}
		}
		$query = call_fuel_func_array('DB::select', $select);

		// Set the defined connection on the query
		$query->set_connection($this->connection);

		// Set from table
		$query->from(array($this->_table(), $this->alias));

		// Build the query further
		$tmp = $this->build_query($query, $columns);

		return $tmp['query'];
	}
332613
public function getAll()
    {
        $fields = implode(', ', $this->fields);
        $sql = 'SELECT ' . $fields . ' FROM ' . $this->table;
        $query = $this->pdo->prepare($sql);
        $query->execute();

        return $query->fetchAll(PDO::FETCH_ASSOC);
    }
202007
private function getSelectQuery()
	{
		$result = $this->getSelectClause();

		if ($join = $this->getJoinClause()) {
			$result .= ' ' . $join;
		}

		if ($where = $this->getWhereClause()) {
			$result .= ' ' . $where;
		}

		if ($groupBy = $this->getGroupByClause()) {
			$result .= ' ' . $groupBy;
		}

		if ($orderBy = $this->getOrderByClause()) {
			$result .= ' ' . $orderBy;
		}

		if ($limit = $this->getLimitClause()) {
			$result .= ' ' . $limit;
		}

		if ($offset = $this->getOffsetClause()) {
			$result .= ' ' . $offset;
		}

		return $result;
	}
697313
public function getQuery()
    {
        $sql = $this->setQuery;
        $sql .= $this->getWhere();
        $sql .= $this->getGroupBy();
        $sql .= $this->getOrderBy();
        $sql .= $this->getHaving();
        $sql .= $this->getLimit();

        $this->setQuery = null;
        $this->setWhere = null;
        $this->setHaving = null;
        $this->setOrderBy = null;
        $this->setGroupBy = null;
        $this->setLimit = null;

        return str_replace('  ', ' ', $sql);
    }
305519
public function getSql()
    {
        $where = (count($this->conditions) === 0)
            ? ''
            : 'WHERE ' . implode(' and ', $this->conditions);
        $sql = "SELECT $this->select FROM $this->table $where $this->order $this->limit $this->offset";
        return $sql;
    }
165064
public function getRows()
    {
        $query = $this->getQuery();
        
        if (!empty($this->columns)) {
            $query->select(implode(', ', $this->columns));
        }
        
        foreach ($this->sort as $key => $value) {
            $query->sortBy($key, $value);
        }
        
        if ($this->range) {
            $query->limit($this->start, $this->range);
        }
        
        if (!empty($this->group)) {
            $query->groupBy($this->group);
        }
        
        return $this->database->query($query, $this->database->getBinds());
    }
211098
public function getQuery()
    {
        $joins = empty($this->joins) ? '' : implode(' ', $this->joins);
        $where = empty($this->where) ? '' : 'WHERE '.implode(' AND ', $this->where);
        $sort = empty($this->sortBy) ? '' : 'ORDER BY '.implode(', ', $this->sortBy);
        $limit = is_null($this->page) ? '' : 'LIMIT ' . $this->page .',' .$this->length;
        $group = empty($this->group) ? '' : 'GROUP BY ' . implode(', ', $this->group);
        
        $query = sprintf(
            'SELECT %s FROM %s %s %s %s %s %s;',
            $this->select,
            $this->from,
            $joins,
            $where,
            $group,
            $sort,
            $limit
        );
        
        return str_replace('  ', ' ', $query);
    }
977805
public function getQueryParams()
    {
        if (isset($this->_queryParams)) {
            return $this->_queryParams;
        }

        if ($queryString = $this->getQueryString()) {
            $result = [];
            parse_str($queryString, $result);
            return $this->_queryParams = $result;
        }

        return $this->_queryParams;
    }
271651
public function getRootAliases()
    {
        $aliases = [];

        foreach ($this->dqlParts['from'] as &$fromClause) {
            if (is_string($fromClause)) {
                $spacePos = strrpos($fromClause, ' ');
                $from     = substr($fromClause, 0, $spacePos);
                $alias    = substr($fromClause, $spacePos + 1);

                $fromClause = new Query\Expr\From($from, $alias);
            }

            $aliases[] = $fromClause->getAlias();
        }

        return $aliases;
    }