## org.eclipse.datatools.sqltools.sqlbuilder.model
Class UpdateHelper

    java.lang.Object
      org.eclipse.datatools.sqltools.sqlbuilder.model.UpdateHelper

    public class UpdateHelper

extends java.lang.Object

Helper class for UpdateStatement

Constructor Summary
`UpdateHelper()`

Method Summary
`static void` `addColumn(QueryUpdateStatement statement, Column column)` Creates an UpdateAssinmentExpression which contains the given Column and its default value, and adds it to the list of assignment expressions in the given update statement
`static void` `addColumn(QueryUpdateStatement statement, ValueExpressionColumn valueExprCol, QueryValueExpression valueExpr)` Creates an UpdateAssignmentExpression which contains the given ValueExpressionColumn and its QueryValueExpression and add it to the list of assignment expressions to the QueryUpdateStatement
`static void` `addColumns(QueryUpdateStatement statement, java.util.List columns)` Creates an UpdateAssinmentExpression which contains the given list of Columns and their default values, and adds it to the list of assignment expressions in the given update statement
`static void` `clearAssignmentExprList(QueryUpdateStatement statement)`
`static void` `clearStatementContents(QueryUpdateStatement stmt)` Clears the contents of the given update statement.Containments which are objects, are set to null and containments which are lists, are cleared.
`static void` `createUpdateSourceExpressionList(UpdateAssignmentExpression assignExpr, ValueExpressionColumn column, QueryValueExpression valueExpr)` Creates an UpdateSourceExpressionList which contains the given QueryValueExpression for the given column and adds it to the given AssignmentExpression
`static void` `createUpdateSourceQuery(UpdateAssignmentExpression assignExpr, QueryExpressionBody query)` Creates an UpdateSourceQuery which contains the given QueryExpressionBody, and adds it to the given AssignmentExpression
`static UpdateAssignmentExpression` `getAssignmentExprForColumn(QueryUpdateStatement statement, ValueExpressionColumn column)` Returns the UpdateAssignmentExpression from the given update statement, which contains the given column
`static ValueExpressionColumn` `getColumnExpressionForName(QueryUpdateStatement statement, java.lang.String columnName)` Looks for a ValueExpressionColumn in the list of assignment expressions in the given statement, with name same as the given name
`static QueryValueExpression` `getDefaultColumnValue(Column column)`
`static java.util.List` `getTargetColumns(QueryUpdateStatement statement)` Returns the list of columns that the given update statement modifies
`static QueryValueExpression` `getValueForColumn(QueryUpdateStatement statement, ValueExpressionColumn column)` Gets a QueryValueExpression in a statement corresponding to the given column
`static void` `refresh(QueryUpdateStatement stmt)` Refreshes the model that ultimately refreseh the UI, this is temporary.
`static void` `removeColumn(QueryUpdateStatement statement, Column column)` This is a wrapper method around removeColumn(QueryUpdateStatement statement,ValueExpressionColumn column) in this class

`static void`

`removeColumn(QueryUpdateStatement statement, ValueExpressionColumn column)`
Removes the given ValueExpressionColumn from the UpdateAssignmentExpression containing it, in the given update statement.If the removed column is the only column in the target column list of the assignment expression then UpdateAssignmentExpression is removed from the list of assignment expressions in the update statement

`static void` `removeTableFromStatement(QueryUpdateStatement statement)` Removes sets the target table of the given Update statement to null
`static void` `replaceStatementContents(QueryUpdateStatement oldStmt, QueryUpdateStatement newStmt)` Replaces the containments in one update statement with the containments in another update statement
`static void` `setTargetTable(QueryUpdateStatement statement, TableInDatabase targetTable)` Sets the target TableExpression of the given Update statement
`static void` `setValueForColumn(UpdateSourceExprList source, ValueExpressionColumn column, QueryValueExpression value)` Updates the value of the given column in the given UpdatesourceExpressionList

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

Constructor Detail

### UpdateHelper

    public UpdateHelper()

Method Detail

### clearAssignmentExprList

    public static void clearAssignmentExprList(QueryUpdateStatement statement)

  Parameters:
    `statement` -

### getTargetColumns

    public static java.util.List getTargetColumns(QueryUpdateStatement statement)

  Returns the list of columns that the given update statement modifies

  Parameters:
    `statement` - the given update statement
  Returns:
    the list of columns referred in the assignment clause of the update statement.

### getAssignmentExprForColumn

    public static UpdateAssignmentExpression getAssignmentExprForColumn(QueryUpdateStatement statement,
                                                                        ValueExpressionColumn column)

  Returns the UpdateAssignmentExpression from the given update statement, which contains the given column

  Parameters:
    `statement` - the update statement
    `column` - the column for which the assisnment expression is to be found
  Returns:
    the UpdateAssignmentExpression containing the column or null if none is found

### removeColumn

    public static void removeColumn(QueryUpdateStatement statement,
                                    ValueExpressionColumn column)

  Removes the given ValueExpressionColumn from the UpdateAssignmentExpression containing it, in the given update statement.If the removed column is the only column in the target column list of the assignment expression then UpdateAssignmentExpression is removed from the list of assignment expressions in the update statement

  Parameters:
    `statement` - the QueryUpdateStatement from which the given column is removed
    `column` - the ValueExpressionColumn being removed

### removeColumn

    public static void removeColumn(QueryUpdateStatement statement,
                                    Column column)

  This is a wrapper method around removeColumn(QueryUpdateStatement statement,ValueExpressionColumn column) in this class

  Parameters:
    `statement` - the QueryUpdateStatement from which the given column is removed
    `column` - the Column to be removed

### replaceStatementContents

    public static void replaceStatementContents(QueryUpdateStatement oldStmt,
                                                QueryUpdateStatement newStmt)

  Replaces the containments in one update statement with the containments in another update statement

  Parameters:
    `oldStmt` - statement in which the containments are being replaced
    `newStmt` - statement whose contents are used to replace contents in oldStmt

### addColumn

    public static void addColumn(QueryUpdateStatement statement,
                                 Column column)

  Creates an UpdateAssinmentExpression which contains the given Column and its default value, and adds it to the list of assignment expressions in the given update statement

  Parameters:
    `statement` - the update statement being modified
    `column` - the column being added

### addColumn

    public static void addColumn(QueryUpdateStatement statement,
                                 ValueExpressionColumn valueExprCol,
                                 QueryValueExpression valueExpr)

  Creates an UpdateAssignmentExpression which contains the given ValueExpressionColumn and its QueryValueExpression and add it to the list of assignment expressions to the QueryUpdateStatement

  Parameters:
    `statement` - the update statement to which the UpdateAssignmentExpression will be assigned
    `valueExprCol` - the ValueExpressionColumn being added
    `valueExpr` - the QueryValueExpression associated with valueExprCol

### addColumns

    public static void addColumns(QueryUpdateStatement statement,
                                  java.util.List columns)

  Creates an UpdateAssinmentExpression which contains the given list of Columns and their default values, and adds it to the list of assignment expressions in the given update statement

  Parameters:
    `statement` - the update statement being modified
    `columns` - the list of Columns being added to the statement

### getDefaultColumnValue

    public static QueryValueExpression getDefaultColumnValue(Column column)

### getValueForColumn

    public static QueryValueExpression getValueForColumn(QueryUpdateStatement statement,
                                                         ValueExpressionColumn column)

  Gets a QueryValueExpression in a statement corresponding to the given column

  Parameters:
    `statement` - the statement from which the value is to be searched
    `column` - the column for which the value is to be searched for
  Returns:
    the value of the column or null if column not found in the statement or the value is not set

### getColumnExpressionForName

    public static ValueExpressionColumn getColumnExpressionForName(QueryUpdateStatement statement,
                                                                   java.lang.String columnName)

  Looks for a ValueExpressionColumn in the list of assignment expressions in the given statement, with name same as the given name

  Parameters:
    `statement` - the statement on which the search needs to be performed
    `columnName` - the name of the ValueExpressionColumn to search for
  Returns:
    the ValueExpressionColumn with a matching name or null if no match is found

### removeTableFromStatement

    public static void removeTableFromStatement(QueryUpdateStatement statement)

  Removes sets the target table of the given Update statement to null

  Parameters:
    `statement` - the update statement

### setValueForColumn

    public static void setValueForColumn(UpdateSourceExprList source,
                                         ValueExpressionColumn column,
                                         QueryValueExpression value)

  Updates the value of the given column in the given UpdatesourceExpressionList

  Parameters:
    `source` - the UpdatesourceExpressionList containing the value for the column
    `column` - the column for which the value is to be updated
    `value` - the new value

### clearStatementContents

    public static void clearStatementContents(QueryUpdateStatement stmt)

  Clears the contents of the given update statement.Containments which are objects, are set to null and containments which are lists, are cleared.

  Parameters:
    `stmt` - the statement being modified

### setTargetTable

    public static void setTargetTable(QueryUpdateStatement statement,
                                      TableInDatabase targetTable)

  Sets the target TableExpression of the given Update statement

  Parameters:
    `statement` - the statement to be modified
    `targetTable` - the new TargetTableExpression

### refresh

    public static void refresh(QueryUpdateStatement stmt)

  Refreshes the model that ultimately refreseh the UI, this is temporary.

  Parameters:
    `stmt` - the QueryUpdateStatement which needs to be refreshed

### createUpdateSourceQuery

    public static void createUpdateSourceQuery(UpdateAssignmentExpression assignExpr,
                                               QueryExpressionBody query)

  Creates an UpdateSourceQuery which contains the given QueryExpressionBody, and adds it to the given AssignmentExpression

  Parameters:
    `assignExpr` - the update assignment expression to be modified
    `query` - the query expression body to connect to the assignment expression.

### createUpdateSourceExpressionList

    public static void createUpdateSourceExpressionList(UpdateAssignmentExpression assignExpr,
                                                        ValueExpressionColumn column,
                                                        QueryValueExpression valueExpr)

  Creates an UpdateSourceExpressionList which contains the given QueryValueExpression for the given column and adds it to the given AssignmentExpression

  Parameters:
    `assignExpr` - the update assignment expression to be modified
    `column` - the column for the expression.
    `query` - the query value expression to connect to the assignment expression.