Class: Virsandra::SelectQuery
- Inherits:
-
Query
- Object
- Query
- Virsandra::SelectQuery
show all
- Defined in:
- lib/virsandra/queries/select_query.rb
Instance Attribute Summary
Attributes inherited from Query
#row, #statement
Instance Method Summary
collapse
Methods inherited from Query
#add, alter, delete, #execute, #fetch, insert, select, #values
Constructor Details
#initialize(columns = nil, skip_validation = false) ⇒ SelectQuery
Returns a new instance of SelectQuery.
3
4
5
6
|
# File 'lib/virsandra/queries/select_query.rb', line 3
def initialize(columns = nil, skip_validation = false)
@columns = columns
@skip_validation = skip_validation
end
|
Instance Method Details
#allow_filtering! ⇒ Object
32
33
34
35
|
# File 'lib/virsandra/queries/select_query.rb', line 32
def allow_filtering!
@allow_filtering = "ALLOW FILTERING"
self
end
|
#deny_filtering! ⇒ Object
37
38
39
40
|
# File 'lib/virsandra/queries/select_query.rb', line 37
def deny_filtering!
@allow_filtering = nil
self
end
|
#from(table) ⇒ Object
8
9
10
11
|
# File 'lib/virsandra/queries/select_query.rb', line 8
def from(table)
@from = TableQuery.new("FROM", table)
self
end
|
#limit(number) ⇒ Object
27
28
29
30
|
# File 'lib/virsandra/queries/select_query.rb', line 27
def limit(number)
@limit = LimitQuery.new(number)
self
end
|
#order(columns) ⇒ Object
22
23
24
25
|
# File 'lib/virsandra/queries/select_query.rb', line 22
def order(columns)
@order = OrderQuery.new(columns)
self
end
|
#reset ⇒ Object
42
43
44
|
# File 'lib/virsandra/queries/select_query.rb', line 42
def reset
@where, @order, @limit = nil
end
|
#to_s ⇒ Object
46
47
48
49
|
# File 'lib/virsandra/queries/select_query.rb', line 46
def to_s
validate
super
end
|
#where(clause) ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/virsandra/queries/select_query.rb', line 13
def where(clause)
unless @where
@where = WhereQuery.new(clause)
else
@where += WhereQuery.new(clause)
end
self
end
|