Gdn_SQLDriver::whereExists PHP Method

whereExists() public method

Adds an Sql exists expression to the $this->_Wheres collection.
public whereExists ( Gdn_DatabaseDriver $SqlDriver, string $Op = 'exists' ) : Gdn_DatabaseDriver
$SqlDriver Gdn_DatabaseDriver The sql to add.
$Op string Either 'exists' or 'not exists'
return Gdn_DatabaseDriver $this
    public function whereExists($SqlDriver, $Op = 'exists')
    {
        $Sql = $Op . " (\r\n" . $SqlDriver->getSelect() . "\n)";
        // Add the inner select.
        $this->_where($Sql);
        // Add the named parameters from the inner select to this statement.
        foreach ($SqlDriver->_NamedParameters as $Name => $Value) {
            $this->_NamedParameters[$Name] = $Value;
        }
        return $this;
    }