Class: FluentQuery::Drivers::Shared::Tokens::SQL::Delete

Inherits:
FluentQuery::Drivers::Shared::Tokens::SQLToken show all
Defined in:
lib/fluent-query/drivers/shared/tokens/sql/delete.rb

Overview

Generic SQL query UPDATE token.

Constant Summary

Constants inherited from FluentQuery::Drivers::Shared::Tokens::SQLToken

FluentQuery::Drivers::Shared::Tokens::SQLToken::TRANSFORMER

Instance Method Summary collapse

Methods inherited from FluentQuery::Drivers::Shared::Tokens::SQLToken

#initialize

Constructor Details

This class inherits a constructor from FluentQuery::Drivers::Shared::Tokens::SQLToken

Instance Method Details

#render!(mode = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fluent-query/drivers/shared/tokens/sql/delete.rb', line 23

def render!(mode = nil)
    processor = @_query.processor
    result = "DELETE"

    @_subtokens.each do |token|
        arguments = token.arguments

        # FROM token
        
        if token.name == :from
            first = arguments.first

            # Checks for arguments
            if (not first.symbol?)
                raise FluentQuery::Drivers::Exception::new("Symbol argument expected for #from method.")
            end

            # Process
            table = processor.quote_identifier(first.to_s)
            result << "FROM " << table

        # Unknown tokens renders directly
        else
            result = self.unknown_token::new(@_driver, @_query, [token]).render!
        end
    end

    return result
end