protected function _run_search($limit = null)
    {
        // get database connection
        $db = $this->getDBConnection("READ");
        $querySQL = $this->getSQLHelper()->buildQuerySQL($this);
        $this->_fetch4countQuery = $querySQL;
        if ($limit && count($limit) > 0 && $limit['count'] > 0) {
            $sql = $db->limit($querySQL, $limit['count'], $limit['offset']);
        } else {
            $sql = $querySQL;
        }

        try {
            if ($this->cacheLifeTime > 0) {
                $cache_id = md5($this->objectName . $sql . serialize($bindValues));
                //try to process cache service.
                $cacheSvc = Openbizx::getService(CACHE_SERVICE, 1);
                $cacheSvc->init($this->objectName, $this->cacheLifeTime);
                if ($cacheSvc->test($cache_id)) {
                    //Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Cache Hit. Query Sql = ".$sql);
                    $resultSetArray = $cacheSvc->load($cache_id);
                } else {
                    Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $sql);
                    $resultSet = $db->query($sql);
                    $resultSetArray = $resultSet->fetchAll();
                    $cacheSvc->save($resultSetArray, $cache_id);
                }
            } else {
                Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $sql);
                $resultSet = $db->query($sql);
                $resultSetArray = $resultSet->fetchAll();
            }
        } catch (Exception $e) {
            Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", "Query Error: " . $e->getMessage());
            $this->errorMessage = $this->getMessage("DATA_ERROR_QUERY") . ": " . $sql . ". " . $e->getMessage();
            throw new \Openbizx\Data\Exception($this->errorMessage);
            return null;
        }
        return $resultSetArray;
    }
protected function _run_search($limit = null)
    {
        // get database connection
        $db = $this->getDBConnection("READ");
        $querySQL = $this->getSQLHelper()->buildQuerySQL($this);
        $this->_fetch4countQuery = $querySQL;
        if ($limit && count($limit) > 0 && $limit['count'] > 0) {
            $sql = $db->limit($querySQL, $limit['count'], $limit['offset']);
        } else {
            $sql = $querySQL;
        }

        try {
            if ($this->cacheLifeTime > 0) {
                $cache_id = md5($this->objectName . $sql . serialize($bindValues));
                //try to process cache service.
                $cacheSvc = Openbizx::getService(CACHE_SERVICE, 1);
                $cacheSvc->init($this->objectName, $this->cacheLifeTime);
                if ($cacheSvc->test($cache_id)) {
                    //Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Cache Hit. Query Sql = ".$sql);
                    $resultSetArray = $cacheSvc->load($cache_id);
                } else {
                    Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $sql);
                    $resultSet = $db->query($sql);
                    $resultSetArray = $resultSet->fetchAll();
                    $cacheSvc->save($resultSetArray, $cache_id);
                }
            } else {
                Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $sql);
                $resultSet = $db->query($sql);
                $resultSetArray = $resultSet->fetchAll();
            }
        } catch (Exception $e) {
            Openbizx::$app->getLog()->log(LOG_ERR, "DATAOBJ", "Query Error: " . $e->getMessage());
            $this->errorMessage = $this->getMessage("DATA_ERROR_QUERY") . ": " . $sql . ". " . $e->getMessage();
            throw new \Openbizx\Data\Exception($this->errorMessage);
            return null;
        }
        return $resultSetArray;
    }
protected function _run_search ( $ limit = null ) { // get database connection $ db = $ this -> getDBConnection ( "READ" ) ; $ querySQL = $ this -> getSQLHelper ( ) -> buildQuerySQL ( $ this ) ; $ this -> _fetch4countQuery = $ querySQL ; if ( $ limit && count ( $ limit ) > 0 && $ limit [ 'count' ] > 0 ) { $ sql = $ db -> limit ( $ querySQL , $ limit [ 'count' ] , $ limit [ 'offset' ] ) ; } else { $ sql = $ querySQL ; } try { if ( $ this -> cacheLifeTime > 0 ) { $ cache_id = md5 ( $ this -> objectName . $ sql . serialize ( $ bindValues ) ) ; //try to process cache service. $ cacheSvc = Openbizx :: getService ( CACHE_SERVICE , 1 ) ; $ cacheSvc -> init ( $ this -> objectName , $ this -> cacheLifeTime ) ; if ( $ cacheSvc -> test ( $ cache_id ) ) { //Openbizx::$app->getLog()->log(LOG_DEBUG, "DATAOBJ", "Cache Hit. Query Sql = ".$sql); $ resultSetArray = $ cacheSvc -> load ( $ cache_id ) ; } else { Openbizx :: $ app -> getLog ( ) -> log ( LOG_DEBUG , "DATAOBJ" , "Query Sql = " . $ sql ) ; $ resultSet = $ db -> query ( $ sql ) ; $ resultSetArray = $ resultSet -> fetchAll ( ) ; $ cacheSvc -> save ( $ resultSetArray , $ cache_id ) ; } } else { Openbizx :: $ app -> getLog ( ) -> log ( LOG_DEBUG , "DATAOBJ" , "Query Sql = " . $ sql ) ; $ resultSet = $ db -> query ( $ sql ) ; $ resultSetArray = $ resultSet -> fetchAll ( ) ; } } catch ( Exception $ e ) { Openbizx :: $ app -> getLog ( ) -> log ( LOG_ERR , "DATAOBJ" , "Query Error: " . $ e -> getMessage ( ) ) ; $ this -> errorMessage = $ this -> getMessage ( "DATA_ERROR_QUERY" ) . ": " . $ sql . ". " . $ e -> getMessage ( ) ; throw new \ Openbizx \ Data \ Exception ( $ this -> errorMessage ) ; return null ; } return $ resultSetArray ; }
Run query with current search rule and returns PDO statement

@param array $limit - if limit is not null, do the limit search
@return PDOStatement
Run query with current search rule and returns PDO statement