Class: SqlStmt::FromQuery

Inherits:
Query
  • Object
show all
Defined in:
lib/sqlstmt/from_query.rb

Direct Known Subclasses

Delete, InsertSelect, InsertValues, Select

Instance Attribute Summary

Attributes inherited from Query

#fields, #joins, #tables, #wheres

Instance Method Summary collapse

Methods inherited from Query

#join, #join_using, #left_join, #left_join_using, #no_where, #optional_join, #optional_where, #table, #to_s, #where

Constructor Details

#initializeFromQuery

Returns a new instance of FromQuery.



6
7
8
9
10
11
12
# File 'lib/sqlstmt/from_query.rb', line 6

def initialize
  super
  @group_by = nil
  @order_by = nil
  @limit = nil
  @having = []
end

Instance Method Details

#group_by(clause) ⇒ Object



14
15
16
17
# File 'lib/sqlstmt/from_query.rb', line 14

def group_by(clause)
  @group_by = clause
  self
end

#having(*sql) ⇒ Object



29
30
31
32
# File 'lib/sqlstmt/from_query.rb', line 29

def having(*sql)
  @having.concat(sql)
  self
end

#limit(clause) ⇒ Object



24
25
26
27
# File 'lib/sqlstmt/from_query.rb', line 24

def limit(clause)
  @limit = clause
  self
end

#order_by(clause) ⇒ Object



19
20
21
22
# File 'lib/sqlstmt/from_query.rb', line 19

def order_by(clause)
  @order_by = clause
  self
end