Gdn_SQLDriver::getWhere PHP Method

getWhere() public method

Builds the select statement and runs the query, returning a result object. Allows a where clause, limit, and offset to be added directly.
public getWhere ( string $Table = '', mixed $Where = false, string $OrderFields = '', string $OrderDirection = 'asc', integer $Limit = false, integer $Offset ) : Gdn_DataSet
$Table string The table from which to select data. Adds to the $this->_Froms collection.
$Where mixed Adds to the $this->_Wheres collection using $this->Where();
$OrderFields string A string of fields to be ordered.
$OrderDirection string The direction of the sort.
$Limit integer The number of records to limit the query to.
$Offset integer The offset where the query results should begin.
return Gdn_DataSet The data returned by the query.
    public function getWhere($Table = '', $Where = false, $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $Offset = 0)
    {
        if ($Table != '') {
            //$this->MapAliases($Table);
            $this->from($Table);
        }
        if ($Where !== false) {
            $this->where($Where);
        }
        if ($OrderFields != '') {
            $this->orderBy($OrderFields, $OrderDirection);
        }
        if ($Limit !== false) {
            $this->limit($Limit, $Offset);
        }
        $Result = $this->query($this->getSelect());
        return $Result;
    }