net.ontopia.topicmaps.query.impl.rdbms
Class ParsedQuery

java.lang.Object
  extended by net.ontopia.topicmaps.query.impl.rdbms.ParsedQuery
All Implemented Interfaces:
ParsedQueryIF, ParsedStatementIF

public final class ParsedQuery
extends java.lang.Object
implements ParsedQueryIF

INTERNAL: Class used to represent parsed queries. The class wraps a query executer and a tolog query intance (as generated by the parser). The actual query execution is delegated to the query executer.


Field Summary
protected  QueryProcessor bprocessor
           
protected  QueryComponentIF[] components
           
protected  boolean has_bclauses
           
protected  int qresult
           
protected  TologQuery query
           
protected  QueryProcessor rprocessor
           
protected  SQLGeneratorIF sqlgen
           
protected  QueryIF sqlquery
           
 
Constructor Summary
ParsedQuery(QueryProcessor rprocessor, QueryProcessor bprocessor, TologQuery query)
           
 
Method Summary
protected  net.ontopia.topicmaps.query.impl.rdbms.ParsedQuery.QueryContext compile(QueryBuilder builder, java.util.List clauses)
           
protected  void compileQuery(QueryBuilder builder, TologQuery query)
           
 QueryResultIF execute()
          PUBLIC: Executes the query, returning the query result.
 QueryResultIF execute(java.util.Map arguments)
          PUBLIC: Executes the query binding the parameters in the query to the values given in the 'arguments' map, returning the query result.
 java.util.Collection getAllVariables()
          PUBLIC: Returns all the variables used in the query, in no particular order.
 java.util.List getClauses()
           
 java.util.Collection getCountedVariables()
          PUBLIC: Returns the variables that are counted in the select clause of the query.
 java.util.List getOrderBy()
          PUBLIC: Returns the variables listed in the order by clause in the order they are given there.
 java.util.List getSelectedVariables()
          PUBLIC: Returns the variables in the select clause of the query, in the order given there.
protected  java.util.List getVariables(java.util.Collection varnames)
           
protected  boolean isIndependent(JDOExpressionIF expr)
           
protected  boolean isOrderableTypes(TologQuery query)
           
 boolean isOrderedAscending(java.lang.String name)
          PUBLIC: Returns true if the named variable is to be sorted in ascending order.
protected  boolean isSupportedArguments(QueryBuilder builder, java.util.List arguments)
           
protected  JDOQuery makeJDOQuery(QueryBuilder builder, net.ontopia.topicmaps.query.impl.rdbms.ParsedQuery.QueryContext qcontext, boolean aggfunc, boolean orderby)
           
protected  QueryMatches prepareQueryMatches(java.util.Map arguments)
           
protected  void prescan(QueryBuilder builder, java.util.List clauses)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

query

protected TologQuery query

rprocessor

protected QueryProcessor rprocessor

bprocessor

protected QueryProcessor bprocessor

components

protected QueryComponentIF[] components

sqlquery

protected QueryIF sqlquery

qresult

protected int qresult

has_bclauses

protected boolean has_bclauses

sqlgen

protected SQLGeneratorIF sqlgen
Constructor Detail

ParsedQuery

public ParsedQuery(QueryProcessor rprocessor,
                   QueryProcessor bprocessor,
                   TologQuery query)
            throws InvalidQueryException
Throws:
InvalidQueryException
Method Detail

compileQuery

protected void compileQuery(QueryBuilder builder,
                            TologQuery query)
                     throws InvalidQueryException
Throws:
InvalidQueryException

makeJDOQuery

protected JDOQuery makeJDOQuery(QueryBuilder builder,
                                net.ontopia.topicmaps.query.impl.rdbms.ParsedQuery.QueryContext qcontext,
                                boolean aggfunc,
                                boolean orderby)
                         throws InvalidQueryException
Throws:
InvalidQueryException

getClauses

public java.util.List getClauses()

getSelectedVariables

public java.util.List getSelectedVariables()
Description copied from interface: ParsedQueryIF
PUBLIC: Returns the variables in the select clause of the query, in the order given there. If there is no select clause all the variables used in the query are returned, in no particular order.

Specified by:
getSelectedVariables in interface ParsedQueryIF
Returns:
An immutable List of String objects.

getAllVariables

public java.util.Collection getAllVariables()
Description copied from interface: ParsedQueryIF
PUBLIC: Returns all the variables used in the query, in no particular order.

Specified by:
getAllVariables in interface ParsedQueryIF
Returns:
An immutable Collection of String objects.

getCountedVariables

public java.util.Collection getCountedVariables()
Description copied from interface: ParsedQueryIF
PUBLIC: Returns the variables that are counted in the select clause of the query. They are returned in no particular order. If there are no counted variables, or if there is no select clause an empty collection is returned.

Specified by:
getCountedVariables in interface ParsedQueryIF
Returns:
An immutable Collection of String objects.

getOrderBy

public java.util.List getOrderBy()
Description copied from interface: ParsedQueryIF
PUBLIC: Returns the variables listed in the order by clause in the order they are given there. In order to see which ones are ascending and which descending, use the isOrderedAscending method.

Specified by:
getOrderBy in interface ParsedQueryIF
Returns:
An immutable List of String objects.

isOrderedAscending

public boolean isOrderedAscending(java.lang.String name)
Description copied from interface: ParsedQueryIF
PUBLIC: Returns true if the named variable is to be sorted in ascending order.

Specified by:
isOrderedAscending in interface ParsedQueryIF

getVariables

protected java.util.List getVariables(java.util.Collection varnames)

execute

public QueryResultIF execute()
                      throws InvalidQueryException
Description copied from interface: ParsedQueryIF
PUBLIC: Executes the query, returning the query result. Query results are not cached, so results are up to date.

Specified by:
execute in interface ParsedQueryIF
Throws:
InvalidQueryException

execute

public QueryResultIF execute(java.util.Map arguments)
                      throws InvalidQueryException
Description copied from interface: ParsedQueryIF
PUBLIC: Executes the query binding the parameters in the query to the values given in the 'arguments' map, returning the query result. Query results are not cached, so results are up to date.

Specified by:
execute in interface ParsedQueryIF
Throws:
InvalidQueryException

prepareQueryMatches

protected QueryMatches prepareQueryMatches(java.util.Map arguments)

prescan

protected void prescan(QueryBuilder builder,
                       java.util.List clauses)

isSupportedArguments

protected boolean isSupportedArguments(QueryBuilder builder,
                                       java.util.List arguments)

compile

protected net.ontopia.topicmaps.query.impl.rdbms.ParsedQuery.QueryContext compile(QueryBuilder builder,
                                                                                  java.util.List clauses)
                                                                           throws InvalidQueryException
Throws:
InvalidQueryException

isIndependent

protected boolean isIndependent(JDOExpressionIF expr)

isOrderableTypes

protected boolean isOrderableTypes(TologQuery query)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2000-2012 Ontopia.