module Rusql
Constants
- VERSION
Public Instance Methods
convert_tz(value, from, to)
click to toggle source
# File lib/rusql.rb, line 34 def convert_tz(value, from, to) ConvertTzFunctionOperand.new(value, from, to) end
count(col)
click to toggle source
# File lib/rusql.rb, line 50 def count(col) raise TypeException.new(Column, col.class) unless col.is_a?(Column) CountSelector.new(col.to_s) end
count_all()
click to toggle source
# File lib/rusql.rb, line 55 def count_all CountSelector.new("*") end
date(value)
click to toggle source
# File lib/rusql.rb, line 30 def date(value) DateFunctionOperand.new(value) end
distinct(sel)
click to toggle source
# File lib/rusql.rb, line 38 def distinct(sel) raise TypeException.new(Selector, sel.class) unless sel.is_a?(Selector) || sel.is_a?(Column) final_sel = sel.is_a?(Column) ? sel.as_selector : sel DistinctFunctionSelector.new(final_sel.to_s) end
group_concat(sel)
click to toggle source
# File lib/rusql.rb, line 44 def group_concat(sel) raise TypeException.new(Selector, sel.class) unless sel.is_a?(Selector) || sel.is_a?(Column) final_sel = sel.is_a?(Column) ? sel.as_selector : sel GroupConcatFunctionSelector.new(final_sel.to_s) end
inner_join(table,condition)
click to toggle source
# File lib/rusql.rb, line 65 def inner_join(table,condition) Join.new(:inner_join, table, condition) end
left_outer_join(table,condition)
click to toggle source
# File lib/rusql.rb, line 73 def left_outer_join(table,condition) Join.new(:left_outer_join, table, condition) end
outer_join(table,condition)
click to toggle source
# File lib/rusql.rb, line 69 def outer_join(table,condition) Join.new(:outer_join, table, condition) end
right_outer_join(table,condition)
click to toggle source
# File lib/rusql.rb, line 77 def right_outer_join(table,condition) Join.new(:right_outer_join, table, condition) end
select(*opts)
click to toggle source
# File lib/rusql.rb, line 81 def select(*opts) opts.each do |arg| raise TypeException.new(Selector, arg.class) unless arg.is_a?(Selector) || arg.is_a?(Column) end Query.new(opts.map{|a| a.is_a?(Column) ? a.as_selector : a }) end
table(name)
click to toggle source
# File lib/rusql.rb, line 59 def table(name) t = Table.new t.name = name t end