class Card::Query::CardQuery
interpret CQL queries, transform them into SQL, and run them.
Public Class Methods
Source
# File lib/card/query/card_query.rb, line 34 def initialize statement, comment=nil super statement @comment = comment || default_comment interpret @statement end
Calls superclass method
Card::Query::AbstractQuery::new
Source
# File lib/card/query/card_query.rb, line 22 def self.viewable_sql Card::Query::SqlStatement.new.permission_conditions("cards") end
By default a query returns card objects. This is accomplished by returning a card identifier from SQL and then hooking into our caching system (see Card::Fetch
)
Public Instance Methods
Source
# File lib/card/query/card_query.rb, line 40 def default_comment return if @superquery || !Card.config.sql_comments statement.to_s end
Source
# File lib/card/query/card_query.rb, line 55 def full? !superquery && mods[:return] != "count" end
Source
# File lib/card/query/card_query.rb, line 51 def limit mods[:limit].to_i end
Query
Hierarchy @root, @subqueries, and @superquery are used to track a hierarchy of query objects. This nesting allows to find, for example, cards that link to cards that link to cards.…