lib/conceptql/query.rb in conceptql-0.0.5 vs lib/conceptql/query.rb in conceptql-0.0.6

- old
+ new

@@ -17,11 +17,11 @@ def query queries.last end def sql - queries.map(&:sql).join(";\n") + ';' + nodes.map { |node| node.sql(db) }.join(";\n") + ';' end # To avoid a performance penalty, only execute the last # SQL statement in an array of ConceptQL statements so that define's # "create_table" SQL isn't executed twice @@ -35,9 +35,13 @@ private attr :yaml, :tree, :db def build_query(db) - tree.root(self).map { |n| n.evaluate(db) } + nodes.map { |n| n.evaluate(db) } + end + + def nodes + @nodes ||= tree.root(self) end end end