Class: Ronin::Code::SQL::Drop

Inherits:
Statement show all
Defined in:
lib/ronin/code/sql/drop.rb

Direct Known Subclasses

DropIndex, DropTable, DropView

Instance Attribute Summary

Attributes inherited from Statement

#clauses

Instance Method Summary collapse

Methods inherited from Statement

clause_order, clauses, #get_clause, #has_clause?, has_clause?

Methods inherited from Expr

#===, #in?, #not_in?

Constructor Details

#initialize(dialect, type, name = nil, options = {}, &block) ⇒ Drop

Returns a new instance of Drop.



29
30
31
32
33
34
35
# File 'lib/ronin/code/sql/drop.rb', line 29

def initialize(dialect,type,name=nil,options={},&block)
  @type = type
  @name = name
  @if_exists = options[:if_exists]

  super(dialect,&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ronin::Code::SQL::Statement

Instance Method Details

#emitObject



42
43
44
45
46
47
48
49
50
# File 'lib/ronin/code/sql/drop.rb', line 42

def emit
  tokens = emit_token('DROP')
  tokens += emit_token(@type)

  tokens += emit_token('IF EXISTS') if @if_exists
  tokens += emit_value(@name)

  return tokens
end

#if_existsObject



37
38
39
40
# File 'lib/ronin/code/sql/drop.rb', line 37

def if_exists
  @if_exists = true
  return self
end