debugging-output removed
This commit is contained in:
parent
75c314159b
commit
09dfa782a8
|
@ -229,7 +229,6 @@ class SmqlToAR
|
||||||
super( *pars)
|
super( *pars)
|
||||||
@value = Array.wrap @value
|
@value = Array.wrap @value
|
||||||
cols = {}
|
cols = {}
|
||||||
p self: self, cols: @cols
|
|
||||||
@cols.each do |col|
|
@cols.each do |col|
|
||||||
col_model = col.relation
|
col_model = col.relation
|
||||||
cols[col] = [col_model] + @value.collect {|val| ConditionTypes.try_parse( col_model, val) }
|
cols[col] = [col_model] + @value.collect {|val| ConditionTypes.try_parse( col_model, val) }
|
||||||
|
@ -250,7 +249,6 @@ class SmqlToAR
|
||||||
b2 = 1 == sub.length ? builder : Or.new( builder)
|
b2 = 1 == sub.length ? builder : Or.new( builder)
|
||||||
sub.each {|i| i.collect( &it.build( And.new( b2), t)); p 'or' => b2 }
|
sub.each {|i| i.collect( &it.build( And.new( b2), t)); p 'or' => b2 }
|
||||||
end
|
end
|
||||||
ap '=>' => builder
|
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -336,7 +334,6 @@ class SmqlToAR
|
||||||
|
|
||||||
class <<self
|
class <<self
|
||||||
def try_parse model, func, args
|
def try_parse model, func, args
|
||||||
SmqlToAR.logger.info( { try_parse: [func,args]}.inspect)
|
|
||||||
self.new model, func, args if self::Name === func and self::Expected.any?( &it === args)
|
self.new model, func, args if self::Name === func and self::Expected.any?( &it === args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -404,7 +401,6 @@ class SmqlToAR
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new model, col, val
|
def self.new model, col, val
|
||||||
SmqlToAR.logger.info( { function: col.first.to_sym }.inspect)
|
|
||||||
r = nil
|
r = nil
|
||||||
constants.each do |c|
|
constants.each do |c|
|
||||||
next if [:Function, :Where, :Expected, :Operator].include? c
|
next if [:Function, :Where, :Expected, :Operator].include? c
|
||||||
|
|
|
@ -142,13 +142,12 @@ class SmqlToAR
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_ar
|
def build_ar
|
||||||
where_str = @_where.type_correction!.optimize!.tap {|x| p x }.build_where
|
where_str = @_where.type_correction!.optimize!.build_where
|
||||||
incls = {}
|
incls = {}
|
||||||
@_includes.each do |inc|
|
@_includes.each do |inc|
|
||||||
b = incls
|
b = incls
|
||||||
inc[1..-1].collect {|rel| b = b[rel] ||= {} }
|
inc[1..-1].collect {|rel| b = b[rel] ||= {} }
|
||||||
end
|
end
|
||||||
@logger.info where: where_str, wobs: @_wobs
|
|
||||||
@model = @model.
|
@model = @model.
|
||||||
select( @_select.join( ', ')).
|
select( @_select.join( ', ')).
|
||||||
joins( @_joins).
|
joins( @_joins).
|
||||||
|
@ -182,7 +181,6 @@ class SmqlToAR
|
||||||
delegate :wobs, :joins, :includes, :sub_joins, :vid, :quote_column_name, :quoter, :quote_table_name, :column, :to => :parent
|
delegate :wobs, :joins, :includes, :sub_joins, :vid, :quote_column_name, :quoter, :quote_table_name, :column, :to => :parent
|
||||||
|
|
||||||
def initialize parent, tmp = false
|
def initialize parent, tmp = false
|
||||||
p init: self, parent: parent
|
|
||||||
@parent = parent
|
@parent = parent
|
||||||
@parent.where self unless @parend.nil? && tmp
|
@parent.where self unless @parend.nil? && tmp
|
||||||
end
|
end
|
||||||
|
@ -207,7 +205,6 @@ class SmqlToAR
|
||||||
end
|
end
|
||||||
|
|
||||||
def optimize!
|
def optimize!
|
||||||
p optimize: self
|
|
||||||
ext = []
|
ext = []
|
||||||
collect! do |sub|
|
collect! do |sub|
|
||||||
sub = sub.optimize! if sub.kind_of? Array
|
sub = sub.optimize! if sub.kind_of? Array
|
||||||
|
@ -220,8 +217,6 @@ class SmqlToAR
|
||||||
sub
|
sub
|
||||||
end
|
end
|
||||||
end.compact!
|
end.compact!
|
||||||
p optimized: self
|
|
||||||
p ext: ext
|
|
||||||
push *ext
|
push *ext
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue