Class: DataMapper::SQLFinders::Query

Inherits:
Query
  • Object
show all
Defined in:
lib/data_mapper/sql_finders/query.rb

Defined Under Namespace

Classes: DefaultDirection

Instance Method Summary collapse

Methods inherited from Query

#normalize_order

Instance Method Details

#fieldsObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/data_mapper/sql_finders/query.rb', line 17

def fields
  return super if super.any? { |f| f.kind_of?(Operator) }
  return super unless @sql_parts && @sql_parts.has_key?(:fields)

  @sql_parts[:fields].map do |field|
    if property = model.properties.detect { |p| p.field == field }
      property
    else
      DataMapper::Property::String.new(model, field)
    end
  end
end

#sqlObject



11
12
13
14
15
# File 'lib/data_mapper/sql_finders/query.rb', line 11

def sql
  @sql_parts  ||= {}
  @sql_values ||= []
  return @sql_parts, @sql_values
end

#sql=(parts, bind_values) ⇒ Object



6
7
8
9
# File 'lib/data_mapper/sql_finders/query.rb', line 6

def sql=(parts, bind_values)
  @sql_parts  = parts
  @sql_values = bind_values
end