## org.eclipse.datatools.modelbase.sql.query.helper
Class StatementHelper

    java.lang.Object
      org.eclipse.datatools.modelbase.sql.query.helper.StatementHelper

    public class StatementHelper

extends java.lang.Object

Nested Class Summary
`static class` `StatementHelper.ValueExpressionComparator` Comparator for sorting ValueExpressionVariables.

Field Summary
`static char` `DELIMITED_IDENTIFIER_QUOTE` TODO: make that DELIMITED_IDENTIFIER_QUOTE char flexible with Database info String constant for the quote that are used for delimited identifiers like "Col1" where this delimited identifier should not be modified to or be compared equal to COL1 or col1, value: "\"", the character "
`static int` `STATEMENT_TYPE_DELETE`
`static int` `STATEMENT_TYPE_FULLSELECT`
`static int` `STATEMENT_TYPE_INSERT`
`static int` `STATEMENT_TYPE_MERGE`
`static int` `STATEMENT_TYPE_SELECT`
`static int` `STATEMENT_TYPE_UPDATE`
`static int` `STATEMENT_TYPE_WITH`

Constructor Summary
`StatementHelper()`
`StatementHelper(Database database)`

Method Summary
`void` `addNewName(Table selectedTable)` Provide the name that will be generated next this is for populating alias text field with a default
`static int` `compareSQL(java.lang.String sql1, java.lang.String sql2)` Compares the SQL source of the given SQL fragments according to their syntax.
`static int` `compareSQL(java.lang.String sql1, java.lang.String sql2, char identifierDelimiterQt)` Compares the SQL source of the given SQL fragments according to their syntax.
`static java.lang.String` `concatName(java.lang.String name, int count)` Return a new name concatenating the int (inside delimiters if need be) Assumes that the name is well-formed, ending with a delimiter if it begins with one.
`static java.lang.String` `convertCatalogIdentifierToSQLFormat(java.lang.String catalogIdentifier, char idDelimiterQuote)` Converts an identifier from catalog format to SQL format.
`static java.lang.String` `convertSQLIdentifierToCatalogFormat(java.lang.String sqlIdentifier, char idDelimiterQuote)` Converts an identifier from SQL format to catalog format.
`static ValueExpressionColumn` `createColumnExpression(java.lang.String name)` Create a new `ValueExpressionColumn` with the given name.
`static ColumnName` `createColumnName(java.lang.String name)` Creates the new ColumnName object and sets the given name.
`static QueryDeleteStatement` `createDeleteStatement(java.lang.String name)`
`static QueryInsertStatement` `createInsertStatement(java.lang.String name)` return false if we cannot find the input name
`QueryInsertStatement` `createInsertStatement(java.lang.String name, boolean addToDb)` Deprecated.
`static QueryMergeStatement` `createMergeStatement(java.lang.String name)` Creates an empty MERGE statement with the given name.
`static QueryCombined` `createQueryCombined()` Creates a QueryCombined
`static QuerySelectStatement` `createQueryCombinedStatement(java.lang.String name)` Creates a QuerySelectStatement statement, with a QueryCombined in it
`static QueryExpressionRoot` `createQueryExpressionRoot()` Creates a QueryExpressionRoot
`static QueryExpressionRoot` `createQueryExpressionRoot(QuerySelectStatement aParent)` Creates a QueryExpressionRoot and attaches it to QuerySelectStatement
`static QueryNested` `createQueryNested()` Creates a QueryNested object.
`static QuerySelect` `createQuerySelect()` Creates a QuerySelect Object
`static QuerySelect` `createQuerySelect(QueryExpressionRoot anExpRoot)` Creates a QuerySelect Object and hook it to a QueryExpressionRoot
`static QuerySelect` `createQuerySelect(QuerySelectStatement aStatement)` Creates a QuerySelect Object and hook it to a QuerySelectStatement
`static QuerySelectStatement` `createQuerySelectStatement(java.lang.String aName)` Creates a QuerySelectStatement
`static QueryStatement` `createQueryStatement(int stmtType, java.lang.String stmtName)` Creates a statement of the given type with the given name.
`QuerySelectStatement` `createSelectStatement(java.lang.String name)`
`static QueryUpdateStatement` `createUpdateStatement(java.lang.String name)`
`QueryUpdateStatement` `createUpdateStatement(java.lang.String name, boolean addToDb)` Deprecated.
`static QuerySelectStatement` `createWithStatement(java.lang.String name)` Creates a WITH query statement.

`static WithTableReference`

`createWithTableReferenceForWithTable(WithTableSpecification withTableSpec)`
Creates a new `WithTableReference` for the given `withTableSpec` and creates `ValueExpressionColumn` objects for each of the given `WithTableSpecification`'s declared columns (`WithTableSpecification.getColumnNameList()`) or, if columns are not declared, for each of the `WithTableSpecification`'s query's result columns.

`static boolean` `equalSQLIdentifiers(java.lang.String ident1, java.lang.String ident2)` Determines whether two SQL identifiers are equal, respecting delimited identifiers using the default delimited identifier quote character.
`static boolean` `equalSQLIdentifiers(java.lang.String ident1, java.lang.String ident2, char delimiterChar)` Determines whether two SQL identifiers are equal, respecting delimited identifiers using the given quote character as delimiter.
`static ResultColumn` `findResultColumnForColumnExpression(QuerySelect select, ValueExpressionColumn columnExpr)` Returns `null` or the `ResultColumn` of the given `QuerySelect` whose `ValueExpression` is of type `ValueExpressionColumn` which in `name` and `tableExpr` equals the given `columnExpr`.
`static ResultColumn` `findResultColumnForColumnNameOrAlias(QuerySelect select, java.lang.String columnNameOrAlias)` Returns `null` or the `ResultColumn` of the given `QuerySelect` whose `name` matches the given `columnNameOrAlias` or whose `ValueExpression` is of type `ValueExpressionColumn` which has a `name` matching the given `columnNameOrAlias`.
`static java.util.List` `getAllParameterMarkersInQueryStatement(QueryStatement queryStmt)` Gets all the parameter marker-type ("?") variables in the given query statement.
`static java.util.List` `getAllVariablesInQueryStatement(QueryStatement queryStmt)` Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.
`static java.util.List` `getAllVariablesInQueryStatement(QueryStatement queryStmt, boolean nameParameterMarkers)` Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.
`static java.util.List` `getAllVariablesInQueryStatement(QueryStatement queryStmt, boolean nameParameterMarkers, java.lang.String varStem)` Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.
`static java.util.List` `getAllVariablesInQueryStatement(QueryStatement queryStmt, java.lang.String varStem)` Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.
`static Database` `getDatabase(QueryStatement stmt)` Returns the Database for which SQL Statement is associated with.
`static char` `getDELIMITED_IDENTIFIER_QUOTE()` Gets the DELIMITED_IDENTIFIER_QUOTE char.
`static TableInDatabase` `getDerivedDatabaseTable(ValueExpressionColumn columnExpr)` Returns the `TableInDatabase` that the given `columnExpr` was derived from, if the given column is not the result of an expression in the `selectClause` of a `QuerySelect` or the result column of a `QueryValues`.
`static java.util.List` `getDerivedDatabaseTables(java.util.List columnExprList)` Returns the `TableInDatabase`s, that the given `columnExpr`s were derived from, if the given columns are not the result of an expression in the `selectClause` of a `QuerySelect` or the result column of a `QueryValues`.
`static java.util.Set` `getDirectReferences(org.eclipse.emf.ecore.EObject eObject, java.lang.Class typeFilter)` Returns all directly referenced Objects of the given `eObject` that are of type or a subtype of the given `typeFilter`.
`static SQLQueryObject` `getEContainerRecursively(org.eclipse.emf.ecore.EObject eObject, java.lang.Class containerType)` Returns the `EObject.eContainer()`for the given `eObject` that is assignable to the given type `containerType`.
`static java.util.List` `getEffectiveResultColumns(QuerySelectStatement selectStmt)` This method compiles a list of `ValueExpressionColumn`s that reflects the columns, in order and with datatype, which are the result of the given `QuerySelectStatement`.
`static QuerySearchCondition` `getHavingCondition(QueryStatement stmt)` Returns "Having" clause for the given statement.
`static QuerySearchCondition` `getHavingCondition(SQLQueryObject stmt)`
`static java.util.List` `getMergeModificationTargetColumnReferences(QueryMergeStatement mergeStmt)` Gets a list of the column value expression in the "modification operations" (Update/Insert) of the given Merge statement that are known to be references to columns in the target table of the Merge statement.
`java.lang.String` `getNewName(QueryInsertStatement insert)`
`static Predicate` `getPredicateOfVariable(ValueExpressionVariable variable)` Returns the `Predicate` of the given `variable` or `null`, if the `variable` has no reference to a `Predicate`.
`static QuerySelect` `getQuerySelectForTableReference(TableExpression tableExpr)` Returns the `QuerySelect` that contains the given `tableExpr` in its `fromClause`.
`static QueryStatement` `getQueryStatementForTableReference(TableReference tableRef)` Returns the `QueryStatement` associated with the given `tableRef`.
`static java.util.Set` `getReferencesRecursively(org.eclipse.emf.ecore.EObject eObject, java.lang.Class typeFilter)` Returns all Objects recursively referenced by the given `eObject`, that are of type or a subtype of the given `typeFilter`.
`static java.util.Set` `getReferencesViaSpecificReferencePaths(org.eclipse.emf.ecore.EObject eObject, java.lang.Class typeFilter, java.lang.Class[] referencePathTypes)` Returns Objects recursively referenced by the given `eObject`, that are of type or a subtype of the given `typeFilter`.
`static java.util.List` `getResultTableAllColumnsInQueryResultSpecificationList(java.util.List queryResultSpecList)` Returns a List containing only the `QueryResultSpecification`s in the given `queryResultSpecList` that are of type `ResultTableAllColumns`.
`static QuerySearchCondition` `getSearchCondition(QueryStatement stmt)` Returns QuerySearchCondition for the given statement.
`static QuerySearchCondition` `getSearchCondition(SQLQueryObject stmt)`
`static java.lang.String` `getSQLForExecution(SQLQueryObject queryObject)` Generates SQL source for the given `queryObject` without any comments and with the current schema qualified tables.
`static java.lang.String` `getSQLQualified(SQLQueryObject queryObject, int qualificationSpec)` Returns the SQL source text of the given `SQLQueryObject` with all identifiers (table and column references) qualified according to the given `qualificationSpec`.
`static java.lang.String` `getSQLSchemaQualified(SQLQueryObject queryObject)` Returns the SQL source text of the given `SQLQueryObject` with all identifiers (table and column references) qualified with their schema name.
`static java.lang.String` `getSQLSourceUnformatted(SQLQueryObject queryObject)` Returns the generated SQL source for the given `queryObject` without any formatting and without comments in a single line.
`static java.lang.String` `getSQLSourceUnformatted(java.lang.String queryStmt)` Returns the given SQL source String in a single line without any formatting.
`static java.lang.String` `getSQLTableQualified(SQLQueryObject queryObject)` Returns the SQL source text of the given `SQLQueryObject` with all column references qualified with table names, but all table names unqualified (without schema name).
`static java.lang.String` `getSQLUnqualified(SQLQueryObject queryObject)` Returns the SQL source text of the given `SQLQueryObject` with all identifiers unqualified (column references without table names, and all table references without schema names).
`static java.lang.String` `getSQLWithComments(SQLQueryObject queryObject)` Returns the generated SQL source for the given `queryObject` with all comments.
`static java.lang.String` `getSQLWithoutComments(SQLQueryObject queryObject)` Returns the generated SQL source for the given `queryObject` without any comments.
`static int` `getStatementType(QueryStatement statement)` Returns the integer constant defined in this class, that represents the given QueryStatement
`static TableExpression` `getTableExpressionForTable(Table table, QuerySelect qSelect)` Returns the TableExpression representing the given Table object,in the given QuerySelect
`static TableExpression` `getTableExpressionForTable(Table table, QuerySelectStatement selectStmt)` Returns the TableExpression representing the given Table object,in the given QuerySelectStatement
`static java.util.List` `getTableExpressionsInQueryExpressionBody(QueryExpressionBody query)`
`static java.util.List` `getTableExpressionsInQuerySelect(QuerySelect querySelect)`
`static java.util.List` `getTableExpressionsVisibleInQuerySelect(QuerySelect querySelect)` Returns the `TableExpression`s in the given `QuerySelect`'s `fromClause` plus all the `TableExpression`s that are visible in the scope of the given `QuerySelect`.
`static java.util.List` `getTablesForStatement(QueryStatement stmt)` Returns List of tables (`TableExpression`) referenced in the statement.
`static java.util.List` `getTablesForStatement(SQLQueryObject stmt)`
`static java.lang.String` `getTemplateSQL(int statementType)` Returns the default SQL template for a statement
`static java.lang.String` `getUniqueVarName(java.util.Vector varNames, java.lang.String name)` Return a unique name for adding an attribute by appending a count to the passed string and also checking for the existence of the name in the vector.
`static boolean` `isColumnNameAmbiguous(ValueExpressionColumn colExpr)` Returns true only if the name of the given column expression is equal to another column's name in a different table.
`static boolean` `isNameUnique(java.util.Vector names, java.lang.String uniqueName)` Checks the passed uniqueName is in the passed array names and returns false if found, true otherwise.
`static boolean` `isOrderByClauseContainsValidOrderBySpecification(java.util.List orderByClause)` Returns `true`, if at least one `OrderBySpecification` contained in the given `orderByClause` list is valid.
`static boolean` `isOrderBySpecificationValid(OrderBySpecification orderBySpec)`
`static boolean` `isTableNameAmbiguous(TableExpression tableExpr)` Returns `true` if the given `tableExpr`'s `name` is not unique within the `fromClause` of its containing `QuerySelect` and the other `TableExpression` s in the `fromClause` as well as the given `TableExpression` have no `TableCorrelation` to distinguish between them.
`static boolean` `isTemplateSQL(java.lang.String sql)` Checks to see if the given string is same as the template for any of the DML statements
`static void` `logDebug(java.lang.String debugMsg)`
`static void` `logError(java.lang.String errorMsg)`
`static boolean` `omitSchema(TableInDatabase tableInDB)` Returns `true` if the given `tableInDB` does not have to be qualified with its `Schema` name.
`static java.lang.String` `removeCommentsInSQL(java.lang.String statement, char delimitedIdentifierQt)` Walks through the given SQL and strips out the comments that are identified by two dashes in line "--" and that are not part of a delimited character string (single quotes), or SQL delimited object name (double quotes).
`static void` `removeTableExpressionFromQueryStatement(TableExpression tableExpr, SQLQueryObject queryObj)` Removes the given `TableExpression` from the given `SQLQueryObject`.
`static void` `removeValueExpression(QueryValueExpression valExpr)` Removes the given ValueExpression object from the object that contains it.
`static java.util.Set` `resolveOrderByColumns(QueryExpressionBody queryExpr, java.util.List orderByList)`

`static java.util.Set`

`resolveOrderByColumns(QuerySelect select, java.util.List orderBySpecList)`
Every given `OrderBySpecification`s contained in the given `orderByList`, that is of type `OrderByValueExpression` and its owned `ValueExpression` is of type `ValueExpressionColumn`, will be removed from the given `QuerySelect` and substituted by a new `OrderByResultColumn` that will then be given the reference to the `ValueExpressionColumn` formerly associated to the removed `OrderByValueExpression`, if the given `QuerySelect` has a `ResultColumn` that refers by its `name` to the same `ValueExpressionColumn`.

`static void` `resolveQueryResultSpecification(QuerySelect querySelect)` Resolves columnExpressions and tableReferences in given `querySelect`'s `QueryResultSpecification` `ResultColumn` or `ResultTableAllColumns` with the columnExpressions and tableExpressions in the given `querySelect`'s `fromClause`.
`static void` `resolveResultTableAllColumns(QuerySelect querySelect)` Resolves tableReferences in given `querySelect`'s `QueryResultSpecification`s of type `ResultTableAllColumns` with the tableExpressions in the given `querySelect`'s `fromClause`.
`static WithTableReference` `resolveWithTableSpecificationReference(TableExpression potentialWithTableRef)` Substitutes the given `TableReference` with the `WithTableSpecification` that is refered by the given `potentialTableWithRef`'s `name`, if a `TableWithSpecification` is found in the `QueryExpressionRoot` that contains the given `TableReference`.
`static void` `setDELIMITED_IDENTIFIER_QUOTE(char delimited_identifier_quote)` Sets the DELIMITED_IDENTIFIER_QUOTE char to make this class flexible with Database info String constant for the quote that are used for delimited identifiers like "Col1" where this delimited identifier should not be modified to or be compared equal to COL1 or col1, value: "\"", the character "
`static void` `setHavingClauseForStatement(QuerySearchCondition newSearchCon, QueryStatement statement)` Sets the having clause in the given sql statement.
`static void` `setHavingClauseForStatement(QuerySearchCondition newSearchCon, SQLQueryObject statement)` Sets the having clause in the given SQLQueryObject.
`static void` `setWhereClauseForStatement(QuerySearchCondition newSearchCon, QueryStatement statement)` Sets the where clause in the given sql statement.
`static void` `setWhereClauseForStatement(QuerySearchCondition newSearchCon, SQLQueryObject statement)` Sets the where clause in the given sqlQueryObject.
`static java.lang.String` `stripWhiteSpace(java.lang.String sql, char delimitedIdentifierQt)` Strips of the optional whitespace from the given `sql` and replaces all new lines with single spaces.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DELIMITED_IDENTIFIER_QUOTE

    public static char DELIMITED_IDENTIFIER_QUOTE

  TODO: make that DELIMITED_IDENTIFIER_QUOTE char flexible with Database info String constant for the quote that are used for delimited identifiers like "Col1" where this delimited identifier should not be modified to or be compared equal to COL1 or col1, value: "\"", the character "

### STATEMENT_TYPE_DELETE

    public static final int STATEMENT_TYPE_DELETE

See Also:
  Constant Field Values

### STATEMENT_TYPE_FULLSELECT

    public static final int STATEMENT_TYPE_FULLSELECT

See Also:
  Constant Field Values

### STATEMENT_TYPE_INSERT

    public static final int STATEMENT_TYPE_INSERT

See Also:
  Constant Field Values

### STATEMENT_TYPE_SELECT

    public static final int STATEMENT_TYPE_SELECT

See Also:
  Constant Field Values

### STATEMENT_TYPE_UPDATE

    public static final int STATEMENT_TYPE_UPDATE

See Also:
  Constant Field Values

### STATEMENT_TYPE_WITH

    public static final int STATEMENT_TYPE_WITH

See Also:
  Constant Field Values

### STATEMENT_TYPE_MERGE

    public static final int STATEMENT_TYPE_MERGE

See Also:
  Constant Field Values

Constructor Detail

### StatementHelper

    public StatementHelper()

### StatementHelper

    public StatementHelper(Database database)

Method Detail

### getDELIMITED_IDENTIFIER_QUOTE

    public static char getDELIMITED_IDENTIFIER_QUOTE()

  Gets the DELIMITED_IDENTIFIER_QUOTE char.

### setDELIMITED_IDENTIFIER_QUOTE

    public static void setDELIMITED_IDENTIFIER_QUOTE(char delimited_identifier_quote)

  Sets the DELIMITED_IDENTIFIER_QUOTE char to make this class flexible with Database info String constant for the quote that are used for delimited identifiers like "Col1" where this delimited identifier should not be modified to or be compared equal to COL1 or col1, value: "\"", the character "

### compareSQL

    public static int compareSQL(java.lang.String sql1,
                                 java.lang.String sql2)

  Compares the SQL source of the given SQL fragments according to their syntax.

  Parameters:
    `sql1` -
    `sql2` -
  Returns:
    `0` if the given SQL fragments are syntactically equivalent

### compareSQL

    public static int compareSQL(java.lang.String sql1,
                                 java.lang.String sql2,
                                 char identifierDelimiterQt)

  Compares the SQL source of the given SQL fragments according to their syntax.

  Parameters:
    `sql1` -
    `sql2` -
    `identifierDelimiterQt` -
  Returns:
    `0` if the given SQL fragments are syntactically equivalent

### convertCatalogIdentifierToSQLFormat

    public static java.lang.String convertCatalogIdentifierToSQLFormat(java.lang.String catalogIdentifier,
                                                                       char idDelimiterQuote)

  Converts an identifier from catalog format to SQL format. See following table for examples.

  SQL format | Catalog format
  --- | ---
  schema1 Schema1 SCHEMA1 "SCHEMA1" | SCHEMA1
  "Schema1" | Schema1
  "Sch""ma1" | Sch"ma1
  "Table A" | Table A
  Table A | Error
  Sch"ma1 | Error

  Parameters:
    `catalogIdentifier` - identifier in catalog format
    `idDelimiterQuote` -
  Returns:
    identifier in SQL format

### convertSQLIdentifierToCatalogFormat

    public static java.lang.String convertSQLIdentifierToCatalogFormat(java.lang.String sqlIdentifier,
                                                                       char idDelimiterQuote)

  Converts an identifier from SQL format to catalog format. See following table for examples.

  SQL format | Catalog format
  --- | ---
  schema1 Schema1 SCHEMA1 "SCHEMA1" | SCHEMA1
  "Schema1" | Schema1
  "Sch""ma1" | Sch"ma1
  "Table A" | Table A
  Table A | Error
  Sch"ma1 | Error

  Parameters:
    `sqlIdentifier` - identifier in SQL format
    `idDelimiterQuote` -
  Returns:
    identifier in catalog format

### createColumnExpression

    public static ValueExpressionColumn createColumnExpression(java.lang.String name)

  Create a new `ValueExpressionColumn` with the given name.

  Parameters:
    `name` - optional name of the result column
  Returns:
    new ValueExpressionColumn

### createColumnName

    public static ColumnName createColumnName(java.lang.String name)

  Creates the new ColumnName object and sets the given name.

  Parameters:
    `name` - the String name of the ColumnName.
  Returns:
    the created ColumnName

### createDeleteStatement

    public static QueryDeleteStatement createDeleteStatement(java.lang.String name)

### createInsertStatement

    public static QueryInsertStatement createInsertStatement(java.lang.String name)

  return false if we cannot find the input name

### createMergeStatement

    public static QueryMergeStatement createMergeStatement(java.lang.String name)

  Creates an empty MERGE statement with the given name.

  Parameters:
    `name` - the name for the statement
  Returns:
    the merge statement

### createQueryCombined

    public static QueryCombined createQueryCombined()

  Creates a QueryCombined

  Returns:
    the created QueryCombined

### createQueryCombinedStatement

    public static QuerySelectStatement createQueryCombinedStatement(java.lang.String name)

  Creates a QuerySelectStatement statement, with a QueryCombined in it

  Parameters:
    `name` - the name of the statement.
  Returns:
    the created QuerySelectStatement statement

### createQueryExpressionRoot

    public static QueryExpressionRoot createQueryExpressionRoot()

  Creates a QueryExpressionRoot

  Returns:
    the created QueryExpressionRoot Object

### createQueryExpressionRoot

    public static QueryExpressionRoot createQueryExpressionRoot(QuerySelectStatement aParent)

  Creates a QueryExpressionRoot and attaches it to QuerySelectStatement

  Parameters:
    `aParent` - the parent QuerySelectStatement
  Returns:
    the QueryExpressionRoot Object or null is aParent is null

### createQueryNested

    public static QueryNested createQueryNested()

  Creates a QueryNested object.

  Returns:

### createQuerySelect

    public static QuerySelect createQuerySelect()

  Creates a QuerySelect Object

  Returns:
    the created QuerySelect Object

### createQuerySelect

    public static QuerySelect createQuerySelect(QueryExpressionRoot anExpRoot)

  Creates a QuerySelect Object and hook it to a QueryExpressionRoot

  Parameters:
    `anExpRoot` - the QueryExpressionRoot
  Returns:
    the QuerySelect Object or null if anExpRoot is null

### createQuerySelect

    public static QuerySelect createQuerySelect(QuerySelectStatement aStatement)

  Creates a QuerySelect Object and hook it to a QuerySelectStatement

  Parameters:
    `aStatement` - the QuerySelectStatement
  Returns:
    the QuerySelect Object or null if aStatement is null

### createQuerySelectStatement

    public static QuerySelectStatement createQuerySelectStatement(java.lang.String aName)

  Creates a QuerySelectStatement

  Parameters:
    `aName` - the name of the statement
  Returns:
    the created QuerySelecteStatement

### createQueryStatement

    public static QueryStatement createQueryStatement(int stmtType,
                                                      java.lang.String stmtName)

  Creates a statement of the given type with the given name. The valid statement types are defined as constants in this class.

  Parameters:
    `stmtType` - the requested statement type
    `stmtName` - the name for the statement
  Returns:
    the new query statement object

### createUpdateStatement

    public static QueryUpdateStatement createUpdateStatement(java.lang.String name)

### createWithStatement

    public static QuerySelectStatement createWithStatement(java.lang.String name)

  Creates a WITH query statement.

  Parameters:
    `name` - the String name of the statement.
  Returns:
    the created QuerySelecteStatement with TableWithSpecification.

### createWithTableReferenceForWithTable

    public static WithTableReference createWithTableReferenceForWithTable(WithTableSpecification withTableSpec)

  Creates a new `WithTableReference` for the given `withTableSpec` and creates `ValueExpressionColumn` objects for each of the given `WithTableSpecification`'s declared columns (`WithTableSpecification.getColumnNameList()`) or, if columns are not declared, for each of the `WithTableSpecification`'s query's result columns.

  Parameters:
    `withTableSpec` -
  Returns:

### equalSQLIdentifiers

    public static boolean equalSQLIdentifiers(java.lang.String ident1,
                                              java.lang.String ident2)

  Determines whether two SQL identifiers are equal, respecting delimited identifiers using the default delimited identifier quote character. (If the given SQL identifiers are delimited, they must match exactly. Otherwise equal identifiers can differ by case.) If one of the identifiers is null, they are considered not equal. If both are null, they are considered equal.

  Parameters:
    `ident1` - a SQL identifier
    `ident2` - another SQL identifier
  Returns:
    true when the identifiers are equal, otherwise false

### equalSQLIdentifiers

    public static boolean equalSQLIdentifiers(java.lang.String ident1,
                                              java.lang.String ident2,
                                              char delimiterChar)

  Determines whether two SQL identifiers are equal, respecting delimited identifiers using the given quote character as delimiter. (If the given SQL identifiers are delimited, they must match exactly. Otherwise equal identifiers can differ by case.) If one of the identifiers is null, they are considered not equal. If both are null, they are considered equal.

  Parameters:
    `ident1` - a SQL identifier
    `ident2` - another SQL identifier
    `identDelimiterQuote` - the delimiter char
  Returns:
    true when the identifiers are equal, otherwise false

### findResultColumnForColumnExpression

    public static ResultColumn findResultColumnForColumnExpression(QuerySelect select,
                                                                   ValueExpressionColumn columnExpr)

  Returns `null` or the `ResultColumn` of the given `QuerySelect` whose `ValueExpression` is of type `ValueExpressionColumn` which in `name` and `tableExpr` equals the given `columnExpr`.

  Parameters:
    `select` -
    `columnExpr` - a `ValueExpressionColumn`
  Returns:

### findResultColumnForColumnNameOrAlias

    public static ResultColumn findResultColumnForColumnNameOrAlias(QuerySelect select,
                                                                    java.lang.String columnNameOrAlias)

  Returns `null` or the `ResultColumn` of the given `QuerySelect` whose `name` matches the given `columnNameOrAlias` or whose `ValueExpression` is of type `ValueExpressionColumn` which has a `name` matching the given `columnNameOrAlias`.

  Parameters:
    `select` -
    `columnNameOrAlias` -
  Returns:

### getAllParameterMarkersInQueryStatement

    public static java.util.List getAllParameterMarkersInQueryStatement(QueryStatement queryStmt)

  Gets all the parameter marker-type ("?") variables in the given query statement.

  Parameters:
    `queryStmt` -
  Returns:

### getAllVariablesInQueryStatement

    public static java.util.List getAllVariablesInQueryStatement(QueryStatement queryStmt)

  Returns all `ValueExpressionVariables` contained in the given `QueryStatement`. All parameter marker-type ("?") variables will be modified to have names VAR0n where n is a sequence number.

  Parameters:
    `queryStmt` - the statement from which variables are wanted
  Returns:
    List of the `ValueExpressionVariable`

### getAllVariablesInQueryStatement

    public static java.util.List getAllVariablesInQueryStatement(QueryStatement queryStmt,
                                                                 java.lang.String varStem)

  Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.

  Parameters:
    `queryStmt` - A SQL statement that might have host variables or parameter markers
    `varStem` - The stem for naming variables from parameter markers
  Returns:
    List of the `ValueExpressionVariable`

### getAllVariablesInQueryStatement

    public static java.util.List getAllVariablesInQueryStatement(QueryStatement queryStmt,
                                                                 boolean nameParameterMarkers)

  Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.

  Parameters:
    `queryStmt` - A SQL statement that might have host variables or parameter markers
    `nameParameterMarkers` - True if you wish to generate names for parameter markers
  Returns:
    List of the `ValueExpressionVariable`

### getAllVariablesInQueryStatement

    public static java.util.List getAllVariablesInQueryStatement(QueryStatement queryStmt,
                                                                 boolean nameParameterMarkers,
                                                                 java.lang.String varStem)

  Returns all `ValueExpressionVariables` contained in the given `QueryStatement`.

  Parameters:
    `queryStmt` - A SQL statement that might have host variables or parameter markers
    `nameParameterMarkers` - True if you wish to generate names for parameter markers
    `varStem` - The stem for naming variables from parameter markers
  Returns:
    List of the `ValueExpressionVariable`

### getUniqueVarName

    public static java.lang.String getUniqueVarName(java.util.Vector varNames,
                                                    java.lang.String name)

  Return a unique name for adding an attribute by appending a count to the passed string and also checking for the existence of the name in the vector.

  Parameters:
    `attrNames` - All attribute names in the type including the inherited attribute names.
    `name` - Name that we append count to.
  Returns:
    unique name of the attribute to be added.

### isNameUnique

    public static boolean isNameUnique(java.util.Vector names,
                                       java.lang.String uniqueName)

  Checks the passed uniqueName is in the passed array names and returns false if found, true otherwise.

  Parameters:
    `names` - Array of names
    `uniqueName` - The name to be checked.
  Returns:
    true if found false otherwise.

### concatName

    public static java.lang.String concatName(java.lang.String name,
                                              int count)

  Return a new name concatenating the int (inside delimiters if need be) Assumes that the name is well-formed, ending with a delimiter if it begins with one.

### getDatabase

    public static Database getDatabase(QueryStatement stmt)

  Returns the Database for which SQL Statement is associated with.

  Parameters:
    `stmt` - the SQLQueryStatement for which Database is needed
  Returns:
    the database

### getDerivedDatabaseTable

    public static TableInDatabase getDerivedDatabaseTable(ValueExpressionColumn columnExpr)

  Returns the `TableInDatabase` that the given `columnExpr` was derived from, if the given column is not the result of an expression in the `selectClause` of a `QuerySelect` or the result column of a `QueryValues`. The derived table of "c1" in "select t1.col1 as c1 from (select col1 from table1) as t1;" would be "table1".

  Parameters:
    `columnExpr` - a `ValueExpressionColumn` that is part of a `TableExpression` s `columnList`( `TableExpression.getColumnList()`) as the tables exposed ordered result columns (not the `ResultColumn` of a `QuerySelect`)
  Returns:
    the `TableInDatabase` the given column was derived from or `null` if the given column is not derived from a `TableInDatabase`

### getDerivedDatabaseTables

    public static java.util.List getDerivedDatabaseTables(java.util.List columnExprList)

  Returns the `TableInDatabase`s, that the given `columnExpr`s were derived from, if the given columns are not the result of an expression in the `selectClause` of a `QuerySelect` or the result column of a `QueryValues`. The derived tables of "select t1.col1, t2.col1 from table1 t1, table2 t2" would be "table1" and "table2".

  Parameters:
    `columnExprList` - a List of `ValueExpressionColumn`s that are part of a `TableExpression` s `columnList`( `TableExpression.getColumnList()`), the tables exposed ordered result columns (not the `ResultColumn` of a `QuerySelect`!)
  Returns:
    the List of `TableInDatabase`s that the given columns were derived from, can be empty

### getDirectReferences

    public static java.util.Set getDirectReferences(org.eclipse.emf.ecore.EObject eObject,
                                                    java.lang.Class typeFilter)

  Returns all directly referenced Objects of the given `eObject` that are of type or a subtype of the given `typeFilter`.

  Parameters:
    `eObject` - the EObject we want to find refernces for
    `typeFilter` - optional the type of the refernced Objects to be returned, may be `null` or `Object.class` to not filter the refernces
  Returns:
    the Set of referenced Objects

### getEContainerRecursively

    public static SQLQueryObject getEContainerRecursively(org.eclipse.emf.ecore.EObject eObject,
                                                          java.lang.Class containerType)

  Returns the `EObject.eContainer()`for the given `eObject` that is assignable to the given type `containerType`.

  For the `ValueExpressionColumn` "col1" in the `QuerySelect` that represents the query `SELECT * FROM tbl1 WHERE col1 = 1`, the eConatiner would be a `PredicateBasic` "col1 = 1", but the eConatiner of type `QuerySelect` would be the whole `QuerySelect`, that eContains the `PredicateBasic`.

  Parameters:
    `eObject` -
    `containerType` -
  Returns:
    `SQLQueryObject` of type `containerType` that ultimately contains the given `eObject`

### getEffectiveResultColumns

    public static java.util.List getEffectiveResultColumns(QuerySelectStatement selectStmt)

  This method compiles a list of `ValueExpressionColumn`s that reflects the columns, in order and with datatype, which are the result of the given `QuerySelectStatement`.

  Note: this method will not return the `ResultColumn` list of the given `selectStmt`'s `QuerySelect`, because these don't necessarily reflect the effective result columns of a star-query for example.

  Note: the returned `ValueExpressionColumn`'s `name` can be `null`, for example when the given `QuerySelectStatement`'s query is of type `QueryValues` ("VALUES (1,2),(3,4)") or if the query is a `QuerySelect` with a unnamed `ResultColumn` like in "SELECT COL1 + 10 FROM TABLE1" where "COL1 + 1" has no alias name.

  Parameters:
    `selectStmt` -
  Returns:
    List of `ValueExpressionColumn`s

### getHavingCondition

    public static QuerySearchCondition getHavingCondition(QueryStatement stmt)

  Returns "Having" clause for the given statement.

  Parameters:
    `stmt` - the QueryStatement for which Having clause needs to be returned
  Returns:
    the having clause

### getHavingCondition

    public static QuerySearchCondition getHavingCondition(SQLQueryObject stmt)

### getMergeModificationTargetColumnReferences

    public static java.util.List getMergeModificationTargetColumnReferences(QueryMergeStatement mergeStmt)

  Gets a list of the column value expression in the "modification operations" (Update/Insert) of the given Merge statement that are known to be references to columns in the target table of the Merge statement. That is the columns on the left side of the Update Set expressions and the Insert target columns.

  Parameters:
    `mergeStmt` - the Merge statement for which the modification target columns are needed
  Returns:
    the list of `ValueExpressionColumn` objects

### getPredicateOfVariable

    public static Predicate getPredicateOfVariable(ValueExpressionVariable variable)

  Returns the `Predicate` of the given `variable` or `null`, if the `variable` has no reference to a `Predicate`.

  Note: If more than one reference of type `Predicate` is found for the given `variable`, the first one found will be returned arbitrarily.

  Parameters:
    `variable` -
  Returns:
    the `Predicate` referencing the given `ValueExpressionVariable`

### getQuerySelectForTableReference

    public static QuerySelect getQuerySelectForTableReference(TableExpression tableExpr)

  Returns the `QuerySelect` that contains the given `tableExpr` in its `fromClause`.

  Parameters:
    `tableExpr` -
  Returns:
    the containing `QuerySelect`

### getQueryStatementForTableReference

    public static QueryStatement getQueryStatementForTableReference(TableReference tableRef)

  Returns the `QueryStatement` associated with the given `tableRef`.

  Parameters:
    `tableRef` -
  Returns:

### getReferencesRecursively

    public static java.util.Set getReferencesRecursively(org.eclipse.emf.ecore.EObject eObject,
                                                         java.lang.Class typeFilter)

  Returns all Objects recursively referenced by the given `eObject`, that are of type or a subtype of the given `typeFilter`.

  Parameters:
    `eObject` - the object we want to find refernces of
    `typeFilter` - optional the type of the refernced Objects to be returned, may be `null` or `Object.class` to not filter the refernces
  Returns:
    Set of `EObject` s referenced recursively of type assignable to `typeFilter`

### getReferencesViaSpecificReferencePaths

    public static java.util.Set getReferencesViaSpecificReferencePaths(org.eclipse.emf.ecore.EObject eObject,
                                                                       java.lang.Class typeFilter,
                                                                       java.lang.Class[] referencePathTypes)

  Returns Objects recursively referenced by the given `eObject`, that are of type or a subtype of the given `typeFilter`. Only such references will be traversed that are of one of the give types in `referencePathTypes`.

  Parameters:
    `eObject` - the object we want to find refernces of
    `typeFilter` - optional the type of the refernced Objects to be returned, may be `null` or `Object.class` to not filter the refernces
    `referencePathTypes` - the types of references that are traversed to reach Objects indirectly referenced by the given `eObject`
  Returns:
    Set of `EObject`s referenced recursively

### getResultTableAllColumnsInQueryResultSpecificationList

    public static java.util.List getResultTableAllColumnsInQueryResultSpecificationList(java.util.List queryResultSpecList)

  Returns a List containing only the `QueryResultSpecification`s in the given `queryResultSpecList` that are of type `ResultTableAllColumns`.

  Parameters:
    `queryResultSpecList` - a List of `QueryResultSpecification`
  Returns:
    a List of `ResultTableAllColumns`

### getSearchCondition

    public static QuerySearchCondition getSearchCondition(QueryStatement stmt)

  Returns QuerySearchCondition for the given statement.

  Parameters:
    `stmt` - the QueryStatement for which search condition needs to be returned
  Returns:
    the search condition

### getSearchCondition

    public static QuerySearchCondition getSearchCondition(SQLQueryObject stmt)

### getSQLForExecution

    public static java.lang.String getSQLForExecution(SQLQueryObject queryObject)

  Generates SQL source for the given `queryObject` without any comments and with the current schema qualified tables.

  Note: this method is not `Thread` -safe, concurrent calls to `SQLQueryObject.getSQL()` on the given `queryObject` might not return the expected result.

  Parameters:
    `queryObject` - a `SQLQueryObject` to get the SQL source for
  Returns:
    the SQL source String of the given `queryObject` without any comments and qualified tables

### getSQLQualified

    public static java.lang.String getSQLQualified(SQLQueryObject queryObject,
                                                   int qualificationSpec)

  Returns the SQL source text of the given `SQLQueryObject` with all identifiers (table and column references) qualified according to the given `qualificationSpec`.

  Note: this method is not `Thread` -safe, concurrent calls to `SQLQueryObject.getSQL()` on the given `queryObject` might not return the expected or even a semantically invalid result.

  Parameters:
    `queryObject` -
    `qualificationSpec` -
    - all identifiers qualified with schema names (incl. table names): `SQLQuerySourceFormat.QUALIFY_IDENTIFIERS_WITH_SCHEMA_NAMES`
    - all identifiers qualified with table names and without schema: `SQLQuerySourceFormat.QUALIFY_IDENTIFIERS_WITH_TABLE_NAMES`
    - all identifiers unqualified (column references without table names and table names without schema): `SQLQuerySourceFormat.QUALIFY_IDENTIFIERS_NEVER`
    - all identifiers qualified according to the context of the SQL statement: `SQLQuerySourceFormat.QUALIFY_IDENTIFIERS_IN_CONTEXT`
  Returns:
    SQL source of the given `SQLQueryObject`

### getSQLSchemaQualified

    public static java.lang.String getSQLSchemaQualified(SQLQueryObject queryObject)

  Returns the SQL source text of the given `SQLQueryObject` with all identifiers (table and column references) qualified with their schema name.

  Note: this method is not `Thread` -safe, concurrent calls to `SQLQueryObject.getSQL()` on the given `queryObject` might not return the expected result.

  Parameters:
    `queryObject` -
  Returns:
    SQL source of the given `SQLQueryObject`

### getSQLSourceUnformatted

    public static java.lang.String getSQLSourceUnformatted(SQLQueryObject queryObject)

  Returns the generated SQL source for the given `queryObject` without any formatting and without comments in a single line. The returned String will have no occurrence of more than one blank " " or and no occurrence of a line break "\n", so that for any given `SQLQueryObject` `queryObject` `getSQLSourceUnformatted(queryObject).indexOf(" "+" ") < 0` is `true` and `getSQLSourceUnformatted(queryObject).indexOf("\n") < 0` is `true`.

  Parameters:
    `queryObject` - a `SQLQueryObject` to get the SQL source for
  Returns:
    the SQL source String of the given `queryObject` without any formatting

### getSQLSourceUnformatted

    public static java.lang.String getSQLSourceUnformatted(java.lang.String queryStmt)

  Returns the given SQL source String in a single line without any formatting. The returned String will have no occurrence of more than one blank " " or and no occurrence of a line break "\n", so that for any given `QueryStatement` `queryStmt` `getSQLSourceUnformatted(queryStmt).indexOf(" "+" ") < 0` is `true` and `getSQLSourceUnformatted(queryStmt).indexOf("\n") < 0` is `true`.

  Note: this method only works on SQL statements without single-line comments! Use `stripWhiteSpaceAndComments(String, char)` for SQL that contains comments.

  Parameters:
    `queryStmt` - the SQL source String of a `QueryStatement`
  Returns:
    the given `queryStmt` SQL source without any formatting

### getSQLTableQualified

    public static java.lang.String getSQLTableQualified(SQLQueryObject queryObject)

  Returns the SQL source text of the given `SQLQueryObject` with all column references qualified with table names, but all table names unqualified (without schema name).

  Note: this method is not `Thread` -safe, concurrent calls to `SQLQueryObject.getSQL()` on the given `queryObject` might not return the expected or even a semantically invalid result.

  Parameters:
    `queryObject` -
  Returns:
    SQL source of the given `SQLQueryObject`

### getSQLUnqualified

    public static java.lang.String getSQLUnqualified(SQLQueryObject queryObject)

  Returns the SQL source text of the given `SQLQueryObject` with all identifiers unqualified (column references without table names, and all table references without schema names).

  Note: this method is not `Thread` -safe, concurrent calls to `SQLQueryObject.getSQL()` on the given `queryObject` might not return the expected or even a semantically invalid result.

  Parameters:
    `queryObject` -
  Returns:
    SQL source of the given `SQLQueryObject`

### getSQLWithComments

    public static java.lang.String getSQLWithComments(SQLQueryObject queryObject)

  Returns the generated SQL source for the given `queryObject` with all comments.

  Parameters:
    `queryObject` - a `SQLQueryObject` to get the SQL source for
  Returns:
    the SQL source String of the given `queryObject` with all comments

### getSQLWithoutComments

    public static java.lang.String getSQLWithoutComments(SQLQueryObject queryObject)

  Returns the generated SQL source for the given `queryObject` without any comments.

  Parameters:
    `queryObject` - a `SQLQueryObject` to get the SQL source for
  Returns:
    the SQL source String of the given `queryObject` without any comments

### getStatementType

    public static int getStatementType(QueryStatement statement)

  Returns the integer constant defined in this class, that represents the given QueryStatement

  Parameters:
    `statement` - the QueryStatement
  Returns:
    the integer constatnt defined in this class, that represents the given QueryStatement or -1 if no matching is found

### getTableExpressionForTable

    public static TableExpression getTableExpressionForTable(Table table,
                                                             QuerySelect qSelect)

  Returns the TableExpression representing the given Table object,in the given QuerySelect

  Parameters:
    `table` - the Table object
    `qSelect` - the QuerySelect in which the TableExpression is searched for
  Returns:
    the TableExpression object, for the Table object,or null if none is found

### getTableExpressionForTable

    public static TableExpression getTableExpressionForTable(Table table,
                                                             QuerySelectStatement selectStmt)

  Returns the TableExpression representing the given Table object,in the given QuerySelectStatement

  Parameters:
    `table` - the Table object
    `selectStmt` - the QuerySelectStatement in which the TableExpression is searched for
  Returns:
    the TableExpression object, for the Table object,or null if none is found

### getTableExpressionsInQueryExpressionBody

    public static java.util.List getTableExpressionsInQueryExpressionBody(QueryExpressionBody query)

  Parameters:
    `query` -
  Returns:

### getTableExpressionsInQuerySelect

    public static java.util.List getTableExpressionsInQuerySelect(QuerySelect querySelect)

### getTableExpressionsVisibleInQuerySelect

    public static java.util.List getTableExpressionsVisibleInQuerySelect(QuerySelect querySelect)

  Returns the `TableExpression`s in the given `QuerySelect`'s `fromClause` plus all the `TableExpression`s that are visible in the scope of the given `QuerySelect`. If the `QuerySelect` given is a nested query or sub-query, all the `TableExpression`s of the super query are appended to the returned list of `TableExpression`s.

  Parameters:
    `querySelect` - the `QuerySelect` for which the visible table expressions are needed
  Returns:
    List of visible `TableExpression`s

### getTablesForStatement

    public static java.util.List getTablesForStatement(QueryStatement stmt)

  Returns List of tables (`TableExpression`) referenced in the statement. For Select statement it returns the source tables of the "From" clause. For Insert, Update and Delete returns the target table. For Merge it returns the target (INTO) table and the source (USING) table.

  Parameters:
    `stmt` - the SQLQueryStatement from which the table are wanted
  Returns:
    the List of table

### getTablesForStatement

    public static java.util.List getTablesForStatement(SQLQueryObject stmt)

### getTemplateSQL

    public static java.lang.String getTemplateSQL(int statementType)

  Returns the default SQL template for a statement

  Parameters:
    `statementType` - the type of the statement
  Returns:
    the SQL template

### isColumnNameAmbiguous

    public static boolean isColumnNameAmbiguous(ValueExpressionColumn colExpr)

  Returns true only if the name of the given column expression is equal to another column's name in a different table. This check only applies to columns in QuerySelect objects and in Merge statements.

  Parameters:
    `colExpr` - the column expression to check
  Returns:
    true when the column name is ambiguous in its context, otherwise false

### isOrderByClauseContainsValidOrderBySpecification

    public static boolean isOrderByClauseContainsValidOrderBySpecification(java.util.List orderByClause)

  Returns `true`, if at least one `OrderBySpecification` contained in the given `orderByClause` list is valid.

  Returns:

### isOrderBySpecificationValid

    public static boolean isOrderBySpecificationValid(OrderBySpecification orderBySpec)

  Parameters:
    `orderBySpec` -
  Returns:

### isTableNameAmbiguous

    public static boolean isTableNameAmbiguous(TableExpression tableExpr)

  Returns `true` if the given `tableExpr`'s `name` is not unique within the `fromClause` of its containing `QuerySelect` and the other `TableExpression` s in the `fromClause` as well as the given `TableExpression` have no `TableCorrelation` to distinguish between them. That is important for column references to that table, which will have to get qualified with the table's `Schema` name.

  Parameters:
    `tableExpr` -
  Returns:
    `true` if the given `tableExpr`'s `name` is not unique within the `fromClause` of its containing `QuerySelect` and the other `TableExpression` s in the `fromClause` as well as the given `TableExpression` have no `TableCorrelation` to distinguish between them

### isTemplateSQL

    public static boolean isTemplateSQL(java.lang.String sql)

  Checks to see if the given string is same as the template for any of the DML statements

  Parameters:
    `sql` - the string to check if it is the template statement
  Returns:
    true of if sql is same as a tmplate , false otherwise

### logDebug

    public static void logDebug(java.lang.String debugMsg)

### logError

    public static void logError(java.lang.String errorMsg)

### omitSchema

    public static boolean omitSchema(TableInDatabase tableInDB)

  Returns `true` if the given `tableInDB` does not have to be qualified with its `Schema` name.

  Note: Assumptions:

  - given `tableInDB` is not `null`
  - given `tableInDB` has (indirect) reference to its `QueryStatement`
  - that `QueryStatement` has reference to its `SQLQuerySourceInfo` and that way indirectly a reference to a `SQLQuerySourceFormat` (`com.ibm.db.models.sql.query.util.SQLQuerySourceFormat#getOmitSchema()`)

  Parameters:
    `tableInDB` -
  Returns:
    `true` if table name does not have to be qualified

### removeCommentsInSQL

    public static java.lang.String removeCommentsInSQL(java.lang.String statement,
                                                       char delimitedIdentifierQt)

  Walks through the given SQL and strips out the comments that are identified by two dashes in line "--" and that are not part of a delimited character string (single quotes), or SQL delimited object name (double quotes).
  NOTE: The given SQL statement string must contain the line-break characters to delimit the "--" comments, otherwise all of the SQL-Statement that comes after the first occurence of a "--" comment be treated as part of the comment and rather be ignored, moreover the resulting statement is likely to fail!

  SELECT EMP_NUM FROM DEPARTEMENT -- pre-accumulated number of employees
  WHERE LOCATION = 'C-Tower--01' OR LOCATION = 'C-Tower-02'

  In this statement the first occurence of "--" would indicate a comment that would be stripped of and the second occurence would be retained, as it is part of a String delimited by the enclosing single quotes.

  Parameters:
    `statement` - A SQL statement
    `delimitedIdentifierQt` - the quote char used to prefix and suffix non-standard identifiers or identifiers that are case sensitive
  Returns:
    The a SQL statement without "--" comments.

### removeTableExpressionFromQueryStatement

    public static void removeTableExpressionFromQueryStatement(TableExpression tableExpr,
                                                               SQLQueryObject queryObj)

  Removes the given `TableExpression` from the given `SQLQueryObject`. The SQLQueryObject should be either a `QueryStatement` or a `QuerySelect`. All references to columns of the TableExpression are removed as well.

  Parameters:
    `tableExpr` - the table expression to remove
    `queryObj` - the query object from which the table expression should be removed

### removeValueExpression

    public static void removeValueExpression(QueryValueExpression valExpr)

  Removes the given ValueExpression object from the object that contains it. If the containing object would then be invalid, remove the containing object as well.

  Parameters:
    `valExpr` - the object to remove

### resolveOrderByColumns

    public static java.util.Set resolveOrderByColumns(QueryExpressionBody queryExpr,
                                                      java.util.List orderByList)

  See Also:
    `resolveOrderByColumns(QuerySelect, List)`

### resolveOrderByColumns

    public static java.util.Set resolveOrderByColumns(QuerySelect select,
                                                      java.util.List orderBySpecList)

  Every given `OrderBySpecification`s contained in the given `orderByList`, that is of type `OrderByValueExpression` and its owned `ValueExpression` is of type `ValueExpressionColumn`, will be removed from the given `QuerySelect` and substituted by a new `OrderByResultColumn` that will then be given the reference to the `ValueExpressionColumn` formerly associated to the removed `OrderByValueExpression`, if the given `QuerySelect` has a `ResultColumn` that refers by its `name` to the same `ValueExpressionColumn`. In other words, the type of a `OrderByValueExpression`, that references a `ValueExpressionColumn` also referred to by one `ResultColumn` of the given `select`, will be changed to `OrderByResultColumn`.

  Note: Returns the Set of `ValueExpressionColumn`s that have been removed from their `OrderByValueExpression`.

  Parameters:
    `select` -
    `orderBySpecList` - List of `OrderBySpecification`s referring to the given `QuerySelect`
  Returns:
    Set of `ValueExpressionColumn`s that have been removed from their `OrderByValueExpression`

### resolveQueryResultSpecification

    public static void resolveQueryResultSpecification(QuerySelect querySelect)

  Resolves columnExpressions and tableReferences in given `querySelect`'s `QueryResultSpecification` `ResultColumn` or `ResultTableAllColumns` with the columnExpressions and tableExpressions in the given `querySelect`'s `fromClause`.

  Parameters:
    `querySelect` -

### resolveResultTableAllColumns

    public static void resolveResultTableAllColumns(QuerySelect querySelect)

  Resolves tableReferences in given `querySelect`'s `QueryResultSpecification`s of type `ResultTableAllColumns` with the tableExpressions in the given `querySelect`'s `fromClause`.

  Parameters:
    `querySelect` -

### resolveWithTableSpecificationReference

    public static WithTableReference resolveWithTableSpecificationReference(TableExpression potentialWithTableRef)

  Substitutes the given `TableReference` with the `WithTableSpecification` that is refered by the given `potentialTableWithRef`'s `name`, if a `TableWithSpecification` is found in the `QueryExpressionRoot` that contains the given `TableReference`.

  Parameters:
    `potentialTableWithRef` -
  Returns:
    the substitute `TableWithSpecification` found

### setHavingClauseForStatement

    public static void setHavingClauseForStatement(QuerySearchCondition newSearchCon,
                                                   QueryStatement statement)

  Sets the having clause in the given sql statement.

  Parameters:
    `newSearchCon` - new QuerySearchCondition that needs to be set.
    `statement` - the SQL Statement on which new having clause needs to set.

### setHavingClauseForStatement

    public static void setHavingClauseForStatement(QuerySearchCondition newSearchCon,
                                                   SQLQueryObject statement)

  Sets the having clause in the given SQLQueryObject.

  Parameters:
    `newSearchCon` - new QuerySearchCondition that needs to be set.
    `statement` - the SQLQueryObject on which new having clause needs to set.

### setWhereClauseForStatement

    public static void setWhereClauseForStatement(QuerySearchCondition newSearchCon,
                                                  QueryStatement statement)

  Sets the where clause in the given sql statement.

  Parameters:
    `newSearchCon` - new QuerySearchCondition that needs to set.
    `statement` - the SQL Statement on which new where clause needs to set.

### setWhereClauseForStatement

    public static void setWhereClauseForStatement(QuerySearchCondition newSearchCon,
                                                  SQLQueryObject statement)

  Sets the where clause in the given sqlQueryObject.

  Parameters:
    `newSearchCon` - new QuerySearchCondition that needs to set.
    `statement` - the SQLObject on which new where clause needs to set.

### stripWhiteSpace

    public static java.lang.String stripWhiteSpace(java.lang.String sql,
                                                   char delimitedIdentifierQt)

  Strips of the optional whitespace from the given `sql` and replaces all new lines with single spaces.

  Note: this method does not strip comments from the given `sql` and consequently makes any given SQL that contains comments invalid, unless the comment is on the last line and no valid SQL succeeds the comment.

  Note performance: this method invokes `String.replaceAll(java.lang.String, java.lang.String)` 11 times after walking through the SQL source two times to remove all comments and transforming the given `sql` into upper case format (respecting delimited identifiers).

  Parameters:
    `sql` - the SQL source string
    `delimitedIdentifierQt` - the String that is used to pre- and suffix delimited identifiers, commonly it is the double-quote char '"'
  Returns:
    the given `sql` in upper case, without comments and with minimal whitespace

### addNewName

    public void addNewName(Table selectedTable)

  Provide the name that will be generated next this is for populating alias text field with a default

### createInsertStatement

    public QueryInsertStatement createInsertStatement(java.lang.String name,
                                                      boolean addToDb)

  Deprecated.

  Parameters:
    `name` -
    `addToDb` -
  Returns:

### createSelectStatement

    public QuerySelectStatement createSelectStatement(java.lang.String name)

### createUpdateStatement

    public QueryUpdateStatement createUpdateStatement(java.lang.String name,
                                                      boolean addToDb)

  Deprecated.

  Parameters:
    `name` -
    `addToDb` -
  Returns:

### getNewName

    public java.lang.String getNewName(QueryInsertStatement insert)