org.intermine.sql.precompute
Class BestQueryExplainer.Candidate

java.lang.Object
  extended by org.intermine.sql.precompute.BestQueryExplainer.Candidate
Enclosing class:
BestQueryExplainer

protected class BestQueryExplainer.Candidate
extends java.lang.Object

A class representing a candidate optimised query.


Field Summary
protected  ExplainResult explainResult
           
protected  Query query
           
protected  java.lang.String queryString
           
protected  int tableCount
           
 
Constructor Summary
BestQueryExplainer.Candidate(Query query)
          Constructor.
BestQueryExplainer.Candidate(java.lang.String queryString)
          Constructor.
 
Method Summary
 boolean betterThan(BestQueryExplainer.Candidate c)
          Returns true if the argument is slower than this, or if the argument is null.
 ExplainResult getExplain()
          Returns the ExplainResult of this Candidate, fetching the data if not already present.
 Query getQuery()
          Returns the Query of this Candidate, converting from a String if necessary.
 java.lang.String getQueryString()
          Returns the String query of this Candidate, converting from Query if necessary.
 int getTableCount()
          Returns the number of tables in this query.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

queryString

protected java.lang.String queryString

query

protected Query query

explainResult

protected ExplainResult explainResult

tableCount

protected int tableCount
Constructor Detail

BestQueryExplainer.Candidate

public BestQueryExplainer.Candidate(java.lang.String queryString)
Constructor.

Parameters:
queryString - an SQL query String

BestQueryExplainer.Candidate

public BestQueryExplainer.Candidate(Query query)
Constructor.

Parameters:
query - a Query
Method Detail

getTableCount

public int getTableCount()
Returns the number of tables in this query.

Returns:
an int

getQueryString

public java.lang.String getQueryString()
Returns the String query of this Candidate, converting from Query if necessary.

Returns:
a String

getQuery

public Query getQuery()
Returns the Query of this Candidate, converting from a String if necessary.

Returns:
a Query

getExplain

public ExplainResult getExplain()
                         throws java.sql.SQLException
Returns the ExplainResult of this Candidate, fetching the data if not already present.

Returns:
an ExplainResult
Throws:
java.sql.SQLException - if an error occurs in the underlying database

betterThan

public boolean betterThan(BestQueryExplainer.Candidate c)
                   throws java.sql.SQLException
Returns true if the argument is slower than this, or if the argument is null.

Parameters:
c - a Candidate
Returns:
a boolean
Throws:
java.sql.SQLException - if an error occurs in the underlying database

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object