Class FromAdapter


  • public class FromAdapter
    extends java.lang.Object
    Adapter for building the FROM clause of a SELECT statement
    • Constructor Detail

      • FromAdapter

        public FromAdapter​(Select select)
        Model the "from" part of the select statement
        Parameters:
        select -
    • Method Detail

      • from

        public FromAdapter from​(java.lang.String tableName)
        Add a table to the from clause returning this FromAdapter ready for the next item
        Parameters:
        tableName -
        Returns:
      • from

        public FromAdapter from​(java.lang.String tableName,
                                Alias alias)
        Add a table with an alias (tab AS foo) to the from clause returning this FromAdapter ready for the next item
        Parameters:
        tableName -
        alias -
        Returns:
      • innerJoin

        public FromAdapter innerJoin​(java.lang.String tableName,
                                     Alias alias,
                                     WhereFragment joinOnPredicate)
        Add an INNER JOIN for the given table
        Parameters:
        tableName -
        alias -
        joinOnPredicate -
        Returns:
      • innerJoin

        public FromAdapter innerJoin​(Select sub,
                                     Alias alias,
                                     WhereFragment joinOnPredicate)
        Add an INNER JOIN for the given sub select
        Parameters:
        sub -
        alias -
        joinOnPredicate -
        Returns:
      • leftOuterJoin

        public FromAdapter leftOuterJoin​(java.lang.String tableName,
                                         Alias alias,
                                         WhereFragment joinOnPredicate)
        Add a LEFT OUTER JOIN for the given table
        Parameters:
        tableName -
        alias -
        joinOnPredicate -
        Returns:
      • where

        public WhereAdapter where​(java.lang.String predicate)
        Start building the "WHERE" clause for the statement
        Parameters:
        predicate -
        Returns:
      • where

        public WhereAdapter where​(java.lang.String tableAlias,
                                  java.lang.String columnName)
        Starts building a WHERE clause with the {tableAlias}.{columnName}
        Parameters:
        tableAlias -
        columnName -
        Returns:
      • where

        public WhereAdapter where()
        Starts building a WHERE clause without any predicate nodes
        Returns:
      • where

        public WhereAdapter where​(ExpNode predicate)
        Builds a WHERE clause starting with the given predicate node
        Parameters:
        predicate -
        Returns:
      • establishWhereClause

        public WhereClause establishWhereClause()
        Adds a where clause if one does not yet exist
        Returns:
      • build

        public Select build()
        Provide the select statement we've been building
        Returns:
      • groupBy

        public GroupByAdapter groupBy​(java.lang.String... expressions)
        Start a group by expression
        Parameters:
        expressions -
        Returns:
      • orderBy

        public OrderByAdapter orderBy​(java.lang.String... expressions)
        Start an ORDER BY expression
        Parameters:
        expressions -
        Returns: