@param BaseQueryObjectInterface $queryObject
@param PDOStatement             $statement

@return mixed
177378
private function getResult(BaseQueryObjectInterface $queryObject, PDOStatement $statement)
    {
        $result = $this->getNormalizedResult($statement);

        if ($queryObject instanceof SingleScalarResultQueryObjectInterface) {
            return $this->getSingleScalarResult($result);
        } elseif ($queryObject instanceof SingleResultQueryObjectInterface) {
            return $this->getSingleResult($result);
        }

        return $result;
    }
1260219
public static function Fetch($statement, $parameters=array(), $fetchMode=PDO::FETCH_BOTH)
	{
		$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->fetch($fetchMode);
	}
449959
public function queryBind(string $sql, $statement = null)
    {
        $sql = $this->compileBindsQuestionMark($sql, $statement);
        if ($sql === false) {
            throw new DBALException(
                sprintf(
                    'Invalid statement binding count with sql query : %s',
                    $sql
                ),
                E_USER_WARNING
            );
        }

        return $this->query($sql);
    }
681480
public function query(string $statement) : array
    {
        try {
            return $this->getConnection()->query($statement)->fetchAll(\PDO::FETCH_ASSOC);
        } catch (\PDOException $e) {
            throw new ParserRuntimeException('Statement could not be executed.', 0, $e);
        }
    }
1342987
public function process(QueryInterface $query)
    {
        if (!$query instanceof ShowQuery || $query->getObject() !== ShowQuery::EXPRESSION_CREATE_DATABASE) {
            return null;
        }

        $database = $query->getCreateObjectExpression(ShowQuery::EXPRESSION_CREATE_DATABASE);

        $newData = [];
        $newData[] = array_map(function ($row) use ($database) {
            return str_replace('{DB}', $database, $row);
        }, self::$data);

        return $this->getResultFromData($newData, self::$fields);
    }
1255282
protected function prepared(PDOStatement $statement)
    {
        $statement->setFetchMode($this->fetchMode);

        $this->event(new Events\StatementPrepared(
            $this, $statement
        ));

        return $statement;
    }
476283
public function buildQuery(QueryAbstract $query)
    {
        $queryParts = $query->getQueryParts();
        return implode(
            ' ',
            array_filter(
                [
                    $queryParts['type'],
                    $this->getFields($queryParts),
                    $this->getTable($queryParts),
                    $this->getSet($queryParts),
                    $this->getValues($queryParts),
                    $this->getJoins($queryParts),
                    $this->getWhere($queryParts),
                    $this->getGroup($queryParts),
                    $this->getOrder($queryParts),
                    $this->getLimit($queryParts)
                ],
                function ($var) {
                    return $var !== null;
                }
            )
        );
    }
222201
public function query($sql)
    {
        $this->numExecutes++;
        $this->numStatements++;
        
        $pdos = $this->_pdo->query($sql);
        
        return new PDOStatement($this, $pdos);
    }
171671
public function prepare($statement, $options = null)
    {
        $options = is_null($options) ? [] : $options;
        if (strpos($statement, ':') !== false) {
            $i = 0;
            $bindKeyMap = [];
            $statement = preg_replace_callback('/:([a-zA-Z_]\w*?)\b/', function ($matches) use (&$i, &$bindKeyMap) {
                $bindKeyMap[$matches[1]] = $i++;

                return '?';
            }, $statement);
        }

        $stmtObj = $this->client->prepare($statement);

        if ($stmtObj) {
            $stmtObj->bindKeyMap = $bindKeyMap ?? [];

            return new PDOStatement($this, $stmtObj, $options);
        } else {
            $statementException = new StatementException($this->client->error, $this->client->errno);
            throw new QueryException($statement, [], $statementException);
        }
    }
343396
public function bindParameters(\PDOStatement $statement)
    {
        foreach (array_keys($this->params) as $key)
        {
            $type = $this->param_types[$key];
            $statement->bindParam($key, $this->params[$key], $type);
        }
        return $this;
    }
933807
public function query($statement, $param1 = null, $param2 = null, $param3 = null)
    {
        if ($param3 !== null) {
            return $this->pdo->query($statement, $param1, $param2, $param3);
        }

        if ($param2 !== null) {
            return $this->pdo->query($statement, $param1, $param2);
        }

        if ($param1 !== null) {
            return $this->pdo->query($statement, $param1);
        }

        return $this->pdo->query($statement);
    }
468385
public function execQuery($statement, $params = array()) {
        $start = microtime(true);
        $query = $this->prepare($statement.'');
        try {
            $query->execute($params);
        } catch (\PDOException $e){
            $this->error($e->getMessage(), array(
                'File' => __FILE__,
                'Line' => __LINE__ - 4,
                'Query' => $statement .'',
                'Params' => $params,
                'Trace' => $e->getTraceAsString()
            ));
            return 0;
        }
        $this->debug($statement, array(
            'params' => $params,
            'execute' => true,
            'rows' => $count = $query->rowCount(),
            'time' => microtime(true) - $start,
            'dns' => $this->dns
        ));
        return $count;
    }
1010664
public final function setFetchObject(string $fetchObject): void
    {
        if (!class_exists($fetchObject)) {
            throw new InvalidValueException("Fetch object class '{$fetchObject}' not found!");
        }

        $this->fetchObject = $fetchObject;
    }
258999
public function enqueueStatement(CNabuDBAbstractStatement $statement)
    {
        if ($statement instanceof CMySQLStatement) {
            $hash = $statement->getHash();
            if (!is_array($this->statements) || count($this->statements) === 0) {
                $this->statements = array($hash => $statement);
            } else {
                $this->statements[$hash] = $statement;
            }
        }
    }
341118
public function applyFilter($qb, FilterInterface $filter, QueryObjectInterface $queryObject)
    {
        if ($queryObject instanceof FilterableQueryObjectInterface) {
            $filterMap = $queryObject->getFilterMap();

            /* @var $filterRule FilterRule */
            foreach ($filter as $filterRule) {
                // rule must be bound
                if (!$filterRule->isBound()) {
                    continue;
                }

                // rule must be present in the filter map
                if (!isset($filterMap[$filterRule->getName()])) {
                    throw new \InvalidArgumentException(\sprintf(
                        'Column "%s" is not present in the filter map',
                        $filterRule->getName()
                    ));
                }

                $this->filterRuleProcessor->process($qb, $filterRule, $filterMap[$filterRule->getName()]);
            }
        }
    }
1229913
public function getObject($query, $object)
    {
        $this->statement = $this->db->query($query);
        if ($this->statement) {
            $this->statement->setFetchMode(\PDO::FETCH_CLASS, $object);
            return $this->statement->fetch();
        }
        return false;
    }
455064
public function bindValues($statement, $bindings)
    {
        foreach ($bindings as $key => $value) {
            $statement->bindValue(
                is_string($key) ? $key : $key + 1, $value,
                is_int($value) ? PDO::PARAM_INT : PDO::PARAM_STR
            );
        }
    }