Class SQLSelectStatement


  • public final class SQLSelectStatement
    extends java.lang.Object
    A SQL select builder of some sort. TODO - change to use Visitor pattern to allow for flexible SQL generation TODO - add support for things like SELECT *, SELECT count(*) TODO - add full support for joins in where clauses TODO - allow better support for bound params
    Author:
    Tim Dudgeon
    • Method Detail

      • isOrderByColsMustBeInSelectCols

        public boolean isOrderByColsMustBeInSelectCols()
        Get the value of orderByColsMustBeInSelectCols.
        Returns:
        The value of orderByColsMustBeInSelectCols
      • isDistinct

        public boolean isDistinct()
      • setDistinct

        public void setDistinct​(boolean b)
      • getSelectElements

        public java.util.List<? extends SQLSelectElement> getSelectElements()
      • getOrderByClause

        public SQLOrderByClause getOrderByClause()
        Getter for property orderByClause.
        Returns:
        Value of property orderByClause.
      • getWhereClause

        public SQLWhereClauseElement getWhereClause()
        Get the current where clause. Not that adding to this can rearrange the where clause elements so if in doubt set the rearranged caluse back using @{link #setWhereClause} or (better) use the @{link addWhereClauseElement} method that automatically handles this.
        Returns:
        The current where claus
      • addWhereClauseElement

        public SQLSelectStatement addWhereClauseElement​(SQLWhereClauseElement where,
                                                        SQLWhereClauseCompositeElement.Type type)
        Add the specified element to those that make up the currnet where clause. The element will be added to the where exisiting elements as needed, re-arranging the clause if necessary.
        Parameters:
        where - The element to add
        type - Whether to add as AND or OR
        Returns:
        "this" so that additions can be chained.
      • generateSql

        public java.lang.String generateSql()