Gdn_SQLDriver::delete PHP Method

delete() public method

Builds and executes a delete from query.
public delete ( mixed $Table = '', mixed $Where = '', integer $Limit = false )
$Table mixed The table (or array of table names) to delete from.
$Where mixed The string on the left side of the where comparison, or an associative array of Field => Value items to compare.
$Limit integer The number of records to limit the query to.
    public function delete($Table = '', $Where = '', $Limit = false)
    {
        if ($Table == '') {
            if (!isset($this->_Froms[0])) {
                return false;
            }
            $Table = $this->_Froms[0];
        } elseif (is_array($Table)) {
            foreach ($Table as $t) {
                $this->delete($t, $Where, $Limit, false);
            }
            return;
        } else {
            $Table = $this->escapeIdentifier($this->Database->DatabasePrefix . $Table);
        }
        if ($Where != '') {
            $this->where($Where);
        }
        if ($Limit !== false) {
            $this->limit($Limit);
        }
        if (count($this->_Wheres) == 0) {
            return false;
        }
        $Sql = $this->getDelete($Table, $this->_Wheres, $this->_Limit);
        return $this->query($Sql, 'delete');
    }