module SQLiterate::Node::Query
Public Instance Methods
common_tables()
click to toggle source
# File lib/sqliterate/node/control/query.rb, line 4 def common_tables Hash[ with_section.tables.map { |t| [t.first, expand_table(t)] } ] end
expand_table(t)
click to toggle source
# File lib/sqliterate/node/control/query.rb, line 15 def expand_table(t) a, b = t b ? b.flat_map { |x| expand_table(x) } : [a] end
tables()
click to toggle source
# File lib/sqliterate/node/control/query.rb, line 8 def tables cte = common_tables query_expression.tables.flat_map { |t| expand_table(t) } .flat_map { |t| cte[t] || [t] } .sort.uniq end