Sha256: 55b6cf261a7bf99d3cb92386d24105e9229ea3fab1df6b24051da3f5fe980b43
Contents?: true
Size: 775 Bytes
Versions: 2
Compression:
Stored size: 775 Bytes
Contents
require 'psych' require_relative 'tree' module ConceptQL class Query attr :statement def initialize(db, statement, tree = Tree.new) @db = db @statement = statement @tree = tree end def queries build_query(db) end def query queries.last end def sql queries.map(&:sql).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 def execute query.all end def types tree.root(self).last.types end private attr :yaml, :tree, :db def build_query(db) tree.root(self).map { |n| n.evaluate(db) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
conceptql-0.0.5 | lib/conceptql/query.rb |
conceptql-0.0.4 | lib/conceptql/query.rb |