org.makumba.providers.query.hql
Class HqlAnalyzer

java.lang.Object
  extended by org.makumba.providers.query.hql.HqlAnalyzer
All Implemented Interfaces:
QueryAnalysis

public class HqlAnalyzer
extends Object
implements QueryAnalysis


Constructor Summary
HqlAnalyzer(antlr.collections.AST pass1, DataDefinition knownLabels)
           
HqlAnalyzer(String query1)
           
 
Method Summary
 String getHackedQuery(String query)
           
 DataDefinition getLabelType(String labelName)
          Gets the type of a label used within the query FIXME: remove, inline everywhere as getLabelTypes().get(labelName) for that to work, OQL and MQL need to put their aliases also in the Map returned by getLabelTypes() HQL does not support aliases in the first place
 Map<String,DataDefinition> getLabelTypes()
          Gets the type of the fields between FROM and WHERE
 List<String> getOrderedParameterNames()
           
 DataDefinition getParameterTypes()
          Gets the types of the query parameters, as resulted from the query analysis.
 antlr.collections.AST getPass1Tree()
          return the pass1 (syntax) AST tree
 DataDefinition getProjectionType()
          Gets the type of the fields between SELECT and FROM
 String getQuery()
          Gets the original query that is analyzed by this object
(package private)  String getTypeName(int i)
           
 Collection<String> getWarnings()
          Get the warnings resulted from query analysis
 int parameterAt(int index)
           
 int parameterNumber()
           
 String toString()
           
 String writeInSQLQuery(NameResolver nr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HqlAnalyzer

public HqlAnalyzer(antlr.collections.AST pass1,
                   DataDefinition knownLabels)

HqlAnalyzer

public HqlAnalyzer(String query1)
Method Detail

getProjectionType

public DataDefinition getProjectionType()
Description copied from interface: QueryAnalysis
Gets the type of the fields between SELECT and FROM

Specified by:
getProjectionType in interface QueryAnalysis
Returns:
A DataDefinition containing in the first field the type and name of the first QL projection, the second field the type and name of the second QL projection $2 etc.

getLabelType

public DataDefinition getLabelType(String labelName)
Description copied from interface: QueryAnalysis
Gets the type of a label used within the query FIXME: remove, inline everywhere as getLabelTypes().get(labelName) for that to work, OQL and MQL need to put their aliases also in the Map returned by getLabelTypes() HQL does not support aliases in the first place

Specified by:
getLabelType in interface QueryAnalysis
Parameters:
labelName - the name of the label
Returns:
The type of the label as declared in the FROM part of the query

getParameterTypes

public DataDefinition getParameterTypes()
Description copied from interface: QueryAnalysis
Gets the types of the query parameters, as resulted from the query analysis.

Specified by:
getParameterTypes in interface QueryAnalysis
Returns:
A DataDefinition containing in the first field the type of the QL parameter mentioned first in the query. Each mentioning of a parameter new will get a new field in this DataDefinition!

parameterNumber

public int parameterNumber()

parameterAt

public int parameterAt(int index)

getOrderedParameterNames

public List<String> getOrderedParameterNames()

getTypeName

String getTypeName(int i)

toString

public String toString()
Overrides:
toString in class Object

getHackedQuery

public String getHackedQuery(String query)

getQuery

public String getQuery()
Description copied from interface: QueryAnalysis
Gets the original query that is analyzed by this object

Specified by:
getQuery in interface QueryAnalysis

getLabelTypes

public Map<String,DataDefinition> getLabelTypes()
Description copied from interface: QueryAnalysis
Gets the type of the fields between FROM and WHERE

Specified by:
getLabelTypes in interface QueryAnalysis
Returns:
A DataDefinition containing in the first field the type and name of the first label, the second field the type and name of the second label $2 etc.

writeInSQLQuery

public String writeInSQLQuery(NameResolver nr)

getPass1Tree

public antlr.collections.AST getPass1Tree()
Description copied from interface: QueryAnalysis
return the pass1 (syntax) AST tree

Specified by:
getPass1Tree in interface QueryAnalysis
Returns:

getWarnings

public Collection<String> getWarnings()
Description copied from interface: QueryAnalysis
Get the warnings resulted from query analysis

Specified by:
getWarnings in interface QueryAnalysis
Returns:
a collection of warnings, as strings