public function getResultsFromQuery($query, $limit = 0, $connection='default')
    {
        try
        {
            $this->queryValidator->isValidQuery($query, $connection);

            $query = $this->queryValidator->getLimitedQuery($query, $limit);

            $this->dynamicRepo->setUp($connection);
            $res = $this->dynamicRepo->execute($query);

            $duration = $this->dynamicRepo->getExecutionDuration();
            $duration = number_format($duration, 7, '.', ',');

            return [
                "results" => $res,
                "duration" => $duration
            ];
        }
        catch (ParameterNotPassedException $e)
        {
            throw $e;
        }
        catch (ValidationFailedException $e)
        {
            throw $e;
        }
        catch (TypeNotValidException $e)
        {
            throw $e;
        }
        catch (DBALException $e)
        {
            $exceptionText = "There was an error when executing the query, your database's message:\n\n{$e->getPrevious()->getMessage()}";
            throw new DatabaseException($exceptionText, 500, $e);
        }
    }