public function selectOne()
    {
        $this->setLimit(1);

        $query = 'SELECT ' . $this->getQueryFields() . ' FROM ' . $this->getTable() . ' ' . $this->getQueryWhere() . ' ' . $this->getQueryOrderBy() . ' ' . $this->getQueryLimit();

        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        if ($statement->rowCount() === 0) {
            throw new ExceptionNoData('No data for current query! (query: ' . $query . ', bind: ' . json_encode($this->binds) . ')', 10001);
        }

        //~ Create new object, set data & save it in cache
        return $this->newDataInstance($statement->fetchObject(), true);
    }
public function selectOne()
    {
        $this->setLimit(1);

        $query = 'SELECT ' . $this->getQueryFields() . ' FROM ' . $this->getTable() . ' ' . $this->getQueryWhere() . ' ' . $this->getQueryOrderBy() . ' ' . $this->getQueryLimit();

        $statement = $this->db->prepare($query);
        $statement->execute($this->binds);

        $this->clear();

        if ($statement->rowCount() === 0) {
            throw new ExceptionNoData('No data for current query! (query: ' . $query . ', bind: ' . json_encode($this->binds) . ')', 10001);
        }

        //~ Create new object, set data & save it in cache
        return $this->newDataInstance($statement->fetchObject(), true);
    }
public function selectOne ( ) { $ this -> setLimit ( 1 ) ; $ query = 'SELECT ' . $ this -> getQueryFields ( ) . ' FROM ' . $ this -> getTable ( ) . ' ' . $ this -> getQueryWhere ( ) . ' ' . $ this -> getQueryOrderBy ( ) . ' ' . $ this -> getQueryLimit ( ) ; $ statement = $ this -> db -> prepare ( $ query ) ; $ statement -> execute ( $ this -> binds ) ; $ this -> clear ( ) ; if ( $ statement -> rowCount ( ) === 0 ) { throw new ExceptionNoData ( 'No data for current query! (query: ' . $ query . ', bind: ' . json_encode ( $ this -> binds ) . ')' , 10001 ) ; } //~ Create new object, set data & save it in cache return $ this -> newDataInstance ( $ statement -> fetchObject ( ) , true ) ; }
Select first rows corresponding to where clause.

@return DataAbstract
@throws ExceptionNoData
Select first rows corresponding to where clause .