Class Index [+]

Quicksearch

Arel::Visitors::PostgreSQL

Private Instance Methods

aliased_orders(orders) click to toggle source
    # File lib/arel/visitors/postgresql.rb, line 44
44:       def aliased_orders orders
45:         #orders = o.orders.map { |x| visit x }.join(', ').split(',')
46:         list = []
47:         orders.each_with_index do |o,i|
48:           list <<
49:             [
50:               "id_list.alias_#{i}",
51:               (o.index(/desc/) && 'DESC')
52:             ].compact.join(' ')
53:         end
54:         list
55:       end
using_distinct_on?(o) click to toggle source
    # File lib/arel/visitors/postgresql.rb, line 36
36:       def using_distinct_on?(o)
37:         o.cores.any? do |core|
38:           core.projections.any? do |projection|
39:             /DISTINCT ON/ === projection
40:           end
41:         end
42:       end
visit_Arel_Nodes_DoesNotMatch(o) click to toggle source
    # File lib/arel/visitors/postgresql.rb, line 32
32:       def visit_Arel_Nodes_DoesNotMatch o
33:         "#{visit o.left} NOT ILIKE #{visit o.right}"
34:       end
visit_Arel_Nodes_Lock(o) click to toggle source
   # File lib/arel/visitors/postgresql.rb, line 5
5:       def visit_Arel_Nodes_Lock o
6:         "FOR UPDATE"
7:       end
visit_Arel_Nodes_Matches(o) click to toggle source
    # File lib/arel/visitors/postgresql.rb, line 28
28:       def visit_Arel_Nodes_Matches o
29:         "#{visit o.left} ILIKE #{visit o.right}"
30:       end
visit_Arel_Nodes_SelectStatement(o) click to toggle source
    # File lib/arel/visitors/postgresql.rb, line 9
 9:       def visit_Arel_Nodes_SelectStatement o
10:         if !o.orders.empty? && using_distinct_on?(o)
11:           subquery        = o.dup
12:           subquery.orders = []
13:           subquery.limit  = nil
14:           subquery.offset = nil
15: 
16:           sql = super(subquery)
17:           [
18:             "SELECT * FROM (#{sql}) AS id_list",
19:             "ORDER BY #{aliased_orders(o.orders).join(', ')}",
20:             ("LIMIT #{o.limit}" if o.limit),
21:             (visit(o.offset) if o.offset),
22:           ].compact.join ' '
23:         else
24:           super
25:         end
26:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.