Module: SQLiterate::Node::Query
- Defined in:
- lib/sqliterate/node/control/query.rb
Instance Method Summary collapse
Instance Method Details
#common_tables ⇒ Object
4 5 6 |
# File 'lib/sqliterate/node/control/query.rb', line 4 def common_tables Hash[ with_section.tables.map { |t| [t.first, (t)] } ] end |
#expand_table(t) ⇒ Object
15 16 17 18 |
# File 'lib/sqliterate/node/control/query.rb', line 15 def (t) a, b = t b ? b.flat_map { |x| (x) } : [a] end |
#tables ⇒ Object
8 9 10 11 12 13 |
# File 'lib/sqliterate/node/control/query.rb', line 8 def tables cte = common_tables query_expression.tables.flat_map { |t| (t) } .flat_map { |t| cte[t] || [t] } .sort.uniq end |