Get query

@return \SelectQueryInterface $query
970161
final public function getQuery()
    {
        if (null === $this->query) {

            $this->query = $this->buildQuery();

            // Apply conditions.
            foreach ($this->conditions as $statement => $value) {
                $this->applyOperator($this->query, $statement, $value);
            }

            $limit = $this->getLimit();

            if (CursorInterface::LIMIT_NONE !== $limit) {
                $this->query->range($this->getOffset(), $limit);
            }
        }

        return $this->query;
    }
549338
public function get()
    {
        $query = $this->getCriteria();

        $args = func_get_args();
        if(empty($args)){
            $args = null;
        }

        $isCollection = $this->isCollection($args);

        $response = '';

        try {
            $response = $this->client->request($this, 'get', $args, array(), $query);
        } catch(Exception $ex) {
            $this->dispatchException($ex);
        }

        return $this->transformResponse($response, $isCollection);
    }
520483
public function makeQuery()
    {
        $query = $this->query()->select($this->makeSelect($this->columns()));

        return $query;
    }
365077
public static function getSelect()
    {
        $connection = self::getConnection();
        $diverName = self::getDriverName();
        return QueryFactor::getSelect($connection, $diverName);
    }
579553
protected function loadQuery(): Query
    {
        return Query::select($this->getFieldsNames())
            ->from(static::$tableName)
            ->where($this->where ?? $this->getPKValue());
    }
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);
    }
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'];
	}
1097567
public function getQuery() {
        $query = 'SELECT '.implode(', ', $this->fields)
                .' FROM '.implode(', ', $this->from);
        if (count($this->conditions) > 0) {
            $query = $query.' WHERE '.implode(' AND ', $this->conditions);
        }
        $query = rtrim($query).';';

        return $query;
    }
1221906
public function create(): Query
    {
        $query = static::new()->scope(...$this->getScopes());

        if ($this->repository) {
            return $query->from($this->repository);
        }

        return $query;
    }
720870
public function getQuery(): Query
    {
        if ($this->table === null) {
            throw new Exception('Unable to build DELETE query when table name is not set');
        }

        $sql = "DELETE FROM {$this->table}";

        if ($this->hasWhere()) {
            $sql .= "\nWHERE{$this->getWhereSql()}";
        }

        return new Query($sql, $this->getBindings(), $this->getAdapterConnection());
    }
484096
public function getResult()
    {
        $query = $this->getQuery();

        if (method_exists($query, 'getResult')) {
            return $query->getResult();
        }

        return $query->execute();
    }
378494
protected function _getQuery()
    {
        // active AJAX component
        $sGroupTable = $this->_getViewName('oxgroups');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sDiscountId) {
            $sQAdd = " from $sGroupTable where 1 ";
        } else {
            $sQAdd = " from oxobject2group left join $sGroupTable on oxobject2group.oxgroupsid=$sGroupTable.oxid ";
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sDiscountId);
        }

        if ($sSynchDiscountId && $sSynchDiscountId != $sDiscountId) {
            $sQAdd .= ' and ' . $sGroupTable . '.oxid not in ( select ' . $sGroupTable . '.oxid from oxobject2group left join ' . $sGroupTable . ' on oxobject2group.oxgroupsid=' . $sGroupTable . '.oxid ';
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sSynchDiscountId) . " ) ";
        }

        return $sQAdd;
    }
335992
public function getQuery() {
		$output	= $this->get('output');
		
		try  {
			$this->set('output', SQLAdapter::SQLQUERY);
			$result = $this->run();
		} catch( \Exception $e ) {
			
		}
		
		$this->set('output', $output);
		
		if( isset($e) ) {
			throw $e;
		}
		
		return $result;
	}
730819
protected function _getQuery()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        // looking for table/view
        $sUserTable = $this->_getViewName('oxuser');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sRoleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchRoleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sRoleId) {
            $sQAdd = " from $sUserTable where 1 ";
        } else {
            $sQAdd = " from $sUserTable, oxobject2group where $sUserTable.oxid=oxobject2group.oxobjectid and ";
            $sQAdd .= " oxobject2group.oxgroupsid = " . $oDb->quote($sRoleId);
        }

        if ($sSynchRoleId && $sSynchRoleId != $sRoleId) {
            $sQAdd .= " and $sUserTable.oxid not in ( select $sUserTable.oxid from $sUserTable, oxobject2group where $sUserTable.oxid=oxobject2group.oxobjectid and ";
            $sQAdd .= " oxobject2group.oxgroupsid = " . $oDb->quote($sSynchRoleId);
            if (!$myConfig->getConfigParam('blMallUsers')) {
                $sQAdd .= " and $sUserTable.oxshopid = '" . $myConfig->getShopId() . "' ";
            }
            $sQAdd .= " ) ";
        }

        if (!$myConfig->getConfigParam('blMallUsers')) {
            $sQAdd .= " and $sUserTable.oxshopid = '" . $myConfig->getShopId() . "' ";
        }

        return $sQAdd;
    }
98763
public function getQuery()
    {
        $query = $this->database->getSelectQuery()->from($this->table);

        foreach ($this->join as $join) {
            if (!is_array($join[2])) {
                $join[2] = [$join[2]];
            }

            $where = array_shift($join[2]);
            if (!empty($join[2])) {
                foreach ($join[2] as $i => $value) {
                    $join[2][$i] = $this->database->bind($value);
                }

                $where = vsprintf($where, $join[2]);
            }

            $query->join($join[0], $join[1], $where, $join[3]);
        }

        foreach ($this->filter as $i => $filter) {
            //array('post_id=%s AND post_title IN %s', 123, array('asd'));
            $where = array_shift($filter);
            if (!empty($filter)) {
                foreach ($filter as $i => $value) {
                    $filter[$i] = $this->database->bind($value);
                }

                $where = vsprintf($where, $filter);
            }

            $query->where($where);
        }

        return $query;
    }
318343
public function get()
	{
		// Get the columns
		$columns = $this->select();

		// 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 from view/table
		$query->from(array($this->_table(), $this->alias));

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

		// Make models hierarchical
		foreach ($models as $name => $values)
		{
			if (strpos($name, '.'))
			{
				unset($models[$name]);
				$rels = explode('.', $name);
				$ref =& $models[array_shift($rels)];
				foreach ($rels as $rel)
				{
					empty($ref['models']) and $ref['models'] = array();
					empty($ref['models'][$rel]) and $ref['models'][$rel] = array();
					$ref =& $ref['models'][$rel];
				}
				$ref = $values;
			}
		}

		$rows = $query->execute($this->connection)->as_array();
		$result = array();
		$model = $this->model;
		$select = $this->select();
		$primary_key = $model::primary_key();
		foreach ($rows as $id => $row)
		{
			$this->hydrate($row, $models, $result, $model, $select, $primary_key);
			unset($rows[$id]);
		}

		// It's all built, now lets execute and start hydration
		return $result;
	}
967416
protected function getRecordByQuery($query)
    {
        return \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC)->select($query);
    }