public function query($pQuery, array $pParams = array())
    {
        $this->_stm = Agl::app()->getDb()->getConnection()->prepare($pQuery);

        if (! $this->_stm->execute($pParams)) {
            $error = $this->_stm->errorInfo();
            throw new Exception("The query failed with message '" . $error[2] . "'");
        }

        if (Agl::app()->isDebugMode()) {
            Agl::app()->getDb()->incrementCounter();
        }

        return $this->_stm->fetchAll(PDO::FETCH_ASSOC);
    }