@param string $query
@param array  $parameters
@param string $fetchMode

@return array
556245
public function fetchAll($query, array $parameters = array(), $fetchMode = null)
    {
        $parameters = $this->parameterTransformer->transform($parameters);

        $this->stopWatch->start('query', 'database');
        $result = $this->reader->fetchAll($query, $parameters, $fetchMode);
        $event = $this->stopWatch->stop('query');

        $this->log($query, $parameters, $event, 'fetch', 'all');

        return $result;
    }
1341465
public function fetchAssoc($query, array $parameters = array())
    {
        $parameters = $this->parameterTransformer->transform($parameters);
        return $this->db->fetchAssoc($query, $parameters);
    }
859852
public function _browse($query, $parameters = [])
    {
        /** @var \AlgoliaSearch\Laravel\ModelHelper $modelHelper */
        $modelHelper = App::make('\AlgoliaSearch\Laravel\ModelHelper');

        $index = null;

        if (isset($parameters['index'])) {
            $index = $modelHelper->getIndices($this, $parameters['index'])[0];
            unset($parameters['index']);
        } else {
            $index = $modelHelper->getIndices($this)[0];
        }

        $result = $index->browse($query, $parameters);

        return $result;
    }
451123
protected function _fetchRow($query, $params)
    {
        $db = $this->db;

        $sth = $db->prepare($query);
        foreach ($params as $key => $val) {
            if (is_int($val)) {
                $sth->bindValue("$key", $val, $db::PARAM_INT);
            } else {
                $sth->bindValue("$key", $val);
            }
        }
        $sth->execute();

        return $sth->fetch($db::FETCH_ASSOC);
    }
400179
public function paginate($fetchMode = PDO::FETCH_ASSOC) {
        $this->fields = $this->fields?$this->fields:'*';
        $this->fields = 'SQL_CALC_FOUND_ROWS '.$this->fields;
        $result = $this->query()->fetchAll($fetchMode);
        $result = $this->_data($result,true);
        $num = $this->sql('SELECT FOUND_ROWS()')->fetchColumn();
        return [$num,$result];
    }
1334320
public static function FetchAll($statement, $parameters = array(), $fetchMode = PDO::FETCH_ASSOC)
	{
		$db = self::connect($fetchMode);

		try
		{
			$query = $db->prepare($statement);
			
			if($query)
			{
				foreach($parameters as $key => $parameter)
				{
					if(!isset($parameter["type"]))
						$parameter["type"] = PDO::PARAM_STR;
					
					$query->bindParam($key,$parameter["value"],$parameter["type"]);
				}
				
				$query->execute();
			}
			else
			{
				throw new \Exception("Sorry, there was a problem with the query statement.");
			}
		}
		catch (PDOException $e)
		{
			$exception = "Sorry, there was a problem with the query. ({$e->getMessage()})";
		}

		if($exception) throw new \Exception($exception);
		
		return $query->fetchAll($fetchMode);
	}
631590
public function fetchs($condition = NULL, $params = NULL, $fields=null, $order='',$fetchMode=PDO::FETCH_ASSOC) {
		 $this->driver->field($fields)->where($condition, $params);
         $order and $this->orderby($order);
         return  $this->fetchAll($fetchMode);
	}
1058191
protected function _fetchAll($query, $params)
    {
        $db = $this->db;
        $sth = $db->prepare($query);
        foreach ($params as $key => $val) {
            if (is_int($val)) {
                $sth->bindValue("$key", $val, $db::PARAM_INT);
            } else {
                $sth->bindValue("$key", $val);
            }
        }
        $sth->execute();
        return $sth->fetchAll($db::FETCH_ASSOC);
    }
1334970
private function executeUsingQueryCache($parameters = null, $hydrationMode = null)
    {
        $rsm        = $this->getResultSetMapping();
        $querykey   = new QueryCacheKey($this->getHash(), $this->lifetime, $this->cacheMode ?: Cache::MODE_NORMAL);
        $queryCache = $this->_em->getCache()->getQueryCache($this->cacheRegion);
        $result     = $queryCache->get($querykey, $rsm, $this->_hints);

        if ($result !== null) {
            if ($this->cacheLogger) {
                $this->cacheLogger->queryCacheHit($queryCache->getRegion()->getName(), $querykey);
            }

            return $result;
        }

        $result = $this->executeIgnoreQueryCache($parameters, $hydrationMode);
        $cached = $queryCache->put($querykey, $rsm, $result, $this->_hints);

        if ($this->cacheLogger) {
            $this->cacheLogger->queryCacheMiss($queryCache->getRegion()->getName(), $querykey);

            if ($cached) {
                $this->cacheLogger->queryCachePut($queryCache->getRegion()->getName(), $querykey);
            }
        }

        return $result;
    }
975738
static public function findByQuery($sqlQuery, array $params, $fetchMode = \PDO::FETCH_OBJ)
    {
        $model = new static;
        if($model->table) {
            $sqlQuery = str_replace(':table', $model->table, $sqlQuery);
        }

        $result = $model->execute($sqlQuery);
        return $result;
    }
1193735
protected function prepareQueryAndParams(string $query, array $params): array
	{
		// Replace IN clause placeholder with escaped values

		replace:

		if(strpos($query, '([?])') !== false)
		{
			foreach($params as $key => $value)
			{
				if(is_array($value))
				{
					array_splice($params, $key, 1, $value);

					$query = preg_replace('/\(\[\?\]\)/', '(' . trim(str_repeat('?, ', count($value)), ', ') . ')', $query, 1);

					goto replace;
				}
			}
		}

		// Return query and parameters

		return [$query, $params];
	}
256367
public function first(string $query, array $params = [], ...$fetchMode)
	{
		$prepared = $this->prepare($query, $params);

		$this->execute($prepared);

		if(!empty($fetchMode))
		{
			$prepared['statement']->setFetchMode(...$fetchMode);
		}

		return $prepared['statement']->fetch();
	}
116089
public function replaceQueryParameters($query, $parameters)
    {
        $i = 0;

        $result = preg_replace_callback(
            '/\?|(:[a-z0-9_]+)/i',
            function ($matches) use ($parameters, &$i) {
                $key = substr($matches[0], 1);
                if (!isset($parameters[$i]) && !isset($parameters[$key])) {
                    return $matches[0];
                }

                $value = isset($parameters[$i]) ? $parameters[$i] : $parameters[$key];
                $result = DoctrineExtension::escapeFunction($value);
                $i++;

                return $result;
            },
            $query
        );

        $result = \SqlFormatter::highlight($result);
        $result = str_replace(array("<pre ", "</pre>"), array("<span ", "</span>"), $result);

        return $result;
    }
261708
public function get_all($query, $params = []) {
		$statement = $this->get_statement($query, $params);
		$statement->execute();
		return $statement->fetch_assoc();
	}
659234
public function fetchCol($query, array $parameters = array())
    {
        $parameters = $this->parameterTransformer->transform($parameters);
        return $this->db->fetchCol($query, $parameters);
    }
408269
protected function runPrepared($query, array $bindings, $fetchMode=null)
    {
        return $this->attempt(function () use ($query, $bindings) {

            $statement = $this->prepared($query, $bindings);
            $statement->execute();

            return $statement;
        }, $query);

    }
886803
public function query(
        Query $query,
        array $parameters = []
    ): Result {
        $this->load();

        return parent::query($query);
    }