Sha256: 59f9e52baaf8a2d48ff2f3c6b870a107c0ed069870f98d91a13ef51e53c70d6d
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 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 tree.opts[:sql_only] = true 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 def execute query.all end def types tree.root(self).last.types end private attr :yaml, :tree, :db def build_query(db) nodes.map { |n| n.evaluate(db) } end def nodes @nodes ||= tree.root(self) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
conceptql-0.1.1 | lib/conceptql/query.rb |