class MdlSql::Join
Attributes
@!attribute type [Symbol] @!attribute table [Table] @!attribute col1 [Symbol/String] @!attribute col2 [Symbol/String] @!attribute op [Symbol]
@!attribute type [Symbol] @!attribute table [Table] @!attribute col1 [Symbol/String] @!attribute col2 [Symbol/String] @!attribute op [Symbol]
@!attribute type [Symbol] @!attribute table [Table] @!attribute col1 [Symbol/String] @!attribute col2 [Symbol/String] @!attribute op [Symbol]
@!attribute type [Symbol] @!attribute table [Table] @!attribute col1 [Symbol/String] @!attribute col2 [Symbol/String] @!attribute op [Symbol]
@!attribute type [Symbol] @!attribute table [Table] @!attribute col1 [Symbol/String] @!attribute col2 [Symbol/String] @!attribute op [Symbol]
Public Class Methods
# File lib/mdlsql/join.rb, line 28 def initialize opts={} @cond1 = opts[:cond1] @cond2 = opts[:cond2] @table = Table.new opts[:table] @type = opts[:type] opts[:op].to_sym if opts[:op].is_a? String @op = opts[:op] @op ||= '='.to_sym end
Public Instance Methods
Literals must be made explicit with apostrophes.
# File lib/mdlsql/join.rb, line 40 def to_mysql # query = String.new query = "\n" query << @type.to_s.upcase << ' ' if @type query << 'JOIN' query << " " << @table.to_mysql query << "\nON #{@cond1} #{@op} #{@cond2}" return query end