Class SQLGenerator

java.lang.Object
com.invirgance.convirgance.olap.sql.SQLGenerator

public class SQLGenerator extends Object
Provides support for creating and outputting SQL queries for working with OLAP.
Author:
jbanes
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAggregate(String function, String column, Table table)
    Adds an Aggregate object into the list of Columns selected for this SQLGenerator.
    void
    addAggregate(String function, String column, Table table, String alias)
    Adds an Aggregate object (with specified alias) into the list of Columns selected for this SQLGenerator.
    void
    addSelect(String column, Table table)
    Adds a Column object into the list of Columns selected for this SQLGenerator.
    void
    addSelect(String column, Table table, String alias)
    Adds a Column object with the specified alias name into the list of Columns for this SQL Generator.
    void
    addTable(Table table)
    Adds the provided Table to the table list of the SQLGenerator
    Generates the String with the full SQL query.
    boolean
    Returns true if the SQLGenerator is case sensitive.
    boolean
    Returns true if the SQLGenerator is set to force the GROUP BY command in queries, false otherwise.
    void
    setCaseSensitive(boolean caseSensitive)
    Sets the case sensitivity for the SQLGenerator as true or false.
    void
    setForceGroupBy(boolean forceGroupBy)
    Sets the forcing of GROUP BY command.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SQLGenerator

      public SQLGenerator()
  • Method Details

    • isCaseSensitive

      public boolean isCaseSensitive()
      Returns true if the SQLGenerator is case sensitive.
      Returns:
      boolean.
    • setCaseSensitive

      public void setCaseSensitive(boolean caseSensitive)
      Sets the case sensitivity for the SQLGenerator as true or false.
      Parameters:
      caseSensitive - boolean value.
    • isForceGroupBy

      public boolean isForceGroupBy()
      Returns true if the SQLGenerator is set to force the GROUP BY command in queries, false otherwise.
      Returns:
      boolean.
    • setForceGroupBy

      public void setForceGroupBy(boolean forceGroupBy)
      Sets the forcing of GROUP BY command.
      Parameters:
      forceGroupBy - boolean.
    • addTable

      public void addTable(Table table)
      Adds the provided Table to the table list of the SQLGenerator
      Parameters:
      table - a Table to include in SQLGenerator.
    • addSelect

      public void addSelect(String column, Table table)
      Adds a Column object into the list of Columns selected for this SQLGenerator.
      Parameters:
      column - String with the column name to be added.
      table - Table associated with the column.
    • addSelect

      public void addSelect(String column, Table table, String alias)
      Adds a Column object with the specified alias name into the list of Columns for this SQL Generator. The Column is constructed using string name provided, the associated table, and the specified alias.
      Parameters:
      column - the string with the column name.
      table - Table associated with the column.
      alias - the string representing the alias for the column name.
    • addAggregate

      public void addAggregate(String function, String column, Table table)
      Adds an Aggregate object into the list of Columns selected for this SQLGenerator.
      Parameters:
      function - the aggregate's function.
      column - the aggregate's name.
      table - table associated with the aggregate.
    • addAggregate

      public void addAggregate(String function, String column, Table table, String alias)
      Adds an Aggregate object (with specified alias) into the list of Columns selected for this SQLGenerator.
      Parameters:
      function - the aggregate's function.
      column - the aggregate's name.
      table - table associated with the aggregate.
      alias - the aggregate's alias.
    • getSQL

      public String getSQL()
      Generates the String with the full SQL query.
      Returns:
      the SQL query string