Package org.intermine.sql.precompute
Class BestQueryExplainer.Candidate
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description protected ExplainResult
explainResult
protected Query
query
protected java.lang.String
queryString
protected int
tableCount
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
-
-
Field Detail
-
queryString
protected java.lang.String queryString
-
query
protected Query query
-
explainResult
protected ExplainResult explainResult
-
tableCount
protected int tableCount
-
-
Constructor Detail
-
Candidate
public Candidate(java.lang.String queryString)
Constructor.- Parameters:
queryString
- an SQL query String
-
Candidate
public 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 classjava.lang.Object
-
-