Class: FluentQuery::Drivers::Shared::Tokens::SQL::Update

Inherits:
FluentQuery::Drivers::Shared::Tokens::SQLToken show all
Defined in:
lib/fluent-query/drivers/shared/tokens/sql/update.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/update.rb', line 23

def render!(mode = nil)

    processor = @_query.processor
    result = "UPDATE "

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

        # UPDATE token
        if token.name == :update

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

            # Process
            table = processor.quote_identifier(arguments.first)
            result << table

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

    return result
end