Class: Virsandra::WhereQuery
- Defined in:
- lib/virsandra/queries/where_query.rb
Constant Summary collapse
- OPERATOR_MAPPING =
{ :lt => "<", :gt => ">", :eq => "=", :lt_or_eq => "<=", :gt_or_eq => ">=", :in => "IN" }
Instance Attribute Summary
Attributes inherited from Query
Instance Method Summary collapse
- #+(where_query) ⇒ Object (also: #merge)
-
#initialize(clause) ⇒ WhereQuery
constructor
A new instance of WhereQuery.
Methods inherited from Query
#add, alter, delete, #execute, #fetch, #from, insert, #limit, #order, select, #to_s, #values, #where
Constructor Details
#initialize(clause) ⇒ WhereQuery
Returns a new instance of WhereQuery.
12 13 14 |
# File 'lib/virsandra/queries/where_query.rb', line 12 def initialize(clause) @clause = clause end |
Instance Method Details
#+(where_query) ⇒ Object Also known as: merge
16 17 18 19 20 21 22 |
# File 'lib/virsandra/queries/where_query.rb', line 16 def +(where_query) if where_query.is_a?(self.class) @clause = [to_s, where_query.to_s.gsub(/^WHERE\s+/, "")].join(" AND ") else raise InvalidQuery.new("WhereQuery can be mereged only with other WhereQuery") end end |