org.makumba.providers
Interface QueryAnalysis

All Known Implementing Classes:
HqlAnalyzer, MqlQueryAnalysis, QueryAST

public interface QueryAnalysis

This interface describes the result of a query analysis.

Since:
0.5.5.10
Version:
$Id: OQLAnalyzer.java,v 2.1 2007/07/18 16:04:57 manuel_gay Exp $
Author:
Cristian Bogdan, Manuel Gay

Method Summary
 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
 DataDefinition getParameterTypes()
          Gets the types of the query parameters, as resulted from the query analysis.
 DataDefinition getProjectionType()
          Gets the type of the fields between SELECT and FROM
 String getQuery()
          Gets the original query that is analyzed by this object
 int parameterAt(int index)
          Gets the number of the parameter mentioned at the position indicated by the given index. query parameters may not get mentioned in the order of their $number, for example $1 may not appear first in the query, $2 may not appear second in the query, etc.
 int parameterNumber()
          Gets the total number of parameters in the query; like $1, $2 etc.
 String writeInSQLQuery(NameResolver nr)
          generate SQL
 

Method Detail

getQuery

String getQuery()
Gets the original query that is analyzed by this object


getProjectionType

DataDefinition getProjectionType()
Gets the type of the fields between SELECT and FROM

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.

getLabelTypes

Map<String,DataDefinition> getLabelTypes()
Gets the type of the fields between FROM and WHERE

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.

getLabelType

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

Parameters:
labelName - the name of the label
Returns:
The type of the label as declared in the FROM part of the query

getParameterTypes

DataDefinition getParameterTypes()
Gets the types of the query parameters, as resulted from the query analysis.

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

int parameterNumber()
Gets the total number of parameters in the query; like $1, $2 etc. Note that if for example. $1 appears twice it will be counted twice.

See Also:
parameterAt(int)

parameterAt

int parameterAt(int index)
Gets the number of the parameter mentioned at the position indicated by the given index. query parameters may not get mentioned in the order of their $number, for example $1 may not appear first in the query, $2 may not appear second in the query, etc.

See Also:
parameterNumber()

writeInSQLQuery

String writeInSQLQuery(NameResolver nr)
generate SQL

Parameters:
nr - the NameResolver that maps DataDefinition names to database names
Returns:
a SQL string