Class Select

  • All Implemented Interfaces:
    QueryObject

    public final class Select
    extends java.lang.Object
    implements QueryObject
    Class to generate SQL select query statements.
    Note: Be aware that the SQL statement will be invalid for empty compound conditions.
    Version:
    $Revision$ $Date: 2009-07-13 17:22:43 (Mon, 27 Jul 2009) $
    Author:
    Ahmad Hassan, Ralf Joachim
    • Constructor Summary

      Constructors 
      Constructor Description
      Select​(java.lang.String name)
      Construct a SQL select statement that selects records of the table provided.
      Select​(Qualifier qualifier)
      Construct a SQL select statement that selects records of the table provided.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(Visitor visitor)
      Accept method to handle incoming visitors.
      void addFrom​(Qualifier qualifier)
      Appends the provided qualifier to the list of qualifiers to be used to build from-clause.
      void addSelect​(Column name)
      Appends the provided field to the list of fields to be fetched from table.
      Condition getCondition()
      Get condition that specifies which records to select.
      java.util.List<Qualifier> getFrom()
      Getter returning from-list currently set.
      java.util.List<Expression> getSelect()
      Getter returning list of Expressions currently set.
      boolean hasFrom()
      Method to check if qualifiers exist to add to from-clause.
      boolean isLocked()
      Get locked-flag that specifies if query has to be executed in locked mode or not.
      void setCondition​(Condition condition)
      Set condition that specifies which records to select.
      void setLocked​(boolean locked)
      Set locked-flag that specifies if query has to be executed in locked mode or not.
      java.lang.String toString()
      Method constructing query string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Select

        public Select​(java.lang.String name)
        Construct a SQL select statement that selects records of the table provided.
        Parameters:
        name - Name of the table to select records of.
      • Select

        public Select​(Qualifier qualifier)
        Construct a SQL select statement that selects records of the table provided.
        Parameters:
        qualifier - Qualifier to select records of.
    • Method Detail

      • addSelect

        public void addSelect​(Column name)
        Appends the provided field to the list of fields to be fetched from table.
        Parameters:
        name - Column object representing a column to be fetched.
      • addFrom

        public void addFrom​(Qualifier qualifier)
        Appends the provided qualifier to the list of qualifiers to be used to build from-clause.
        Parameters:
        qualifier - Qualifier to be added to from-clause.
      • getSelect

        public java.util.List<Expression> getSelect()
        Getter returning list of Expressions currently set.
        Returns:
        List of current expressions.
      • getFrom

        public java.util.List<Qualifier> getFrom()
        Getter returning from-list currently set.
        Returns:
        From-list currently set.
      • getCondition

        public Condition getCondition()
        Get condition that specifies which records to select.
        Returns:
        Condition that specifies which records to select.
      • setCondition

        public void setCondition​(Condition condition)
        Set condition that specifies which records to select.
        Parameters:
        condition - Condition that specifies which records to select.
      • isLocked

        public boolean isLocked()
        Get locked-flag that specifies if query has to be executed in locked mode or not.
        Returns:
        True: execute query in locked mode, False: execute without lock.
      • setLocked

        public void setLocked​(boolean locked)
        Set locked-flag that specifies if query has to be executed in locked mode or not.
        Parameters:
        locked - True: execute query in locked mode, False: execute without lock.
      • hasFrom

        public boolean hasFrom()
        Method to check if qualifiers exist to add to from-clause.
        Returns:
        True: List of froms is not empty. False: List of froms is empty.
      • toString

        public java.lang.String toString()
        Method constructing query string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        Constructed query string.
      • accept

        public void accept​(Visitor visitor)
        Accept method to handle incoming visitors.
        Specified by:
        accept in interface QueryObject
        Parameters:
        visitor - Visitor to be handled.