Class BestQueryExplainer.Candidate

  • Enclosing class:
    BestQueryExplainer

    protected class BestQueryExplainer.Candidate
    extends java.lang.Object
    A class representing a candidate optimised query.
    • Constructor Summary

      Constructors 
      Constructor Description
      Candidate​(java.lang.String queryString)
      Constructor.
      Candidate​(Query query)
      Constructor.
    • 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()
      • 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
      • 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 class java.lang.Object