framework/db/Query.php
public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return false;
        }
        $command = $this->createCommand($db);
        $params = $command->params;
        $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql()));
        $command->bindValues($params);
        return (bool) $command->queryScalar();
    }
public function exists($db = null)
    {
        if ($this->emulateExecution) {
            return false;
        }
        $command = $this->createCommand($db);
        $params = $command->params;
        $command->setSql($command->db->getQueryBuilder()->selectExists($command->getSql()));
        $command->bindValues($params);
        return (bool) $command->queryScalar();
    }
public function exists ( $ db = null ) { if ( $ this -> emulateExecution ) { return false ; } $ command = $ this -> createCommand ( $ db ) ; $ params = $ command -> params ; $ command -> setSql ( $ command -> db -> getQueryBuilder ( ) -> selectExists ( $ command -> getSql ( ) ) ) ; $ command -> bindValues ( $ params ) ; return ( bool ) $ command -> queryScalar ( ) ; }
Returns a value indicating whether the query result contains any row of data.
@param Connection $db the database connection used to generate the SQL statement.
If this parameter is not given, the `db` application component will be used.
@return bool whether the query result contains any row of data.
Returns a value indicating whether the query result contains any row of data .