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

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

    public class InsertHelper

extends java.lang.Object

Helper class for InsertStatement

Constructor Summary
`InsertHelper()`

Method Summary
`static void` `addColumn(org.eclipse.emf.edit.domain.EditingDomain editDomain, QueryInsertStatement statement, Column column)` Adds the given column to the target list of columns in the given insert statement.
`static void` `addDefaultInsertValue(org.eclipse.emf.edit.domain.EditingDomain editDomain, QueryInsertStatement statement, Column column)` Adds a default value for the given column in the given insert statement.
`static void` `addInsertColumnValuePair(QueryInsertStatement insertStmt, ValueExpressionColumn column, QueryValueExpression valueExpr)` Adds the given column and value to the given insert statement.
`static void` `addInsertQuery(QueryInsertStatement insertStmt)` Adds an empty query expresion to the insert statement.
`static void` `addOrReplaceTargetTable(TableInDatabase targetTable, QueryInsertStatement stmt)` Adds or replaces the target table in the given statement with the given table expression.
`static void` `clearStatementContents(QueryInsertStatement stmt)` Clears the contents of the given insert statement.Containments which are objects, are set to null and containments which are lists, are cleared.
`static ValueExpressionColumn` `getColumnExpressionForName(QueryInsertStatement insertStmt, java.lang.String columnName)` Returns the SQLValueExpressionColumn in the givern insert statement, which has the given name.
`static QueryValueExpression` `getInsertValueforColumn(QueryInsertStatement insertStmt, ValueExpressionColumn colExpr)` Returns the SQLValueExpression from the first row of insert values in the given statement, corresponding to the given column,
`static void` `refresh(QueryInsertStatement insert)` Temporary to method to refresh the viewers in cases where notification does not work
`static void` `removeAllColumnsAndValues(QueryInsertStatement stmt)`
`static void` `removeColumn(QueryInsertStatement statement, Column column)` Removes the given Column and its value from the given insert statement
`static void` `removeColumn(QueryInsertStatement statement, ValueExpressionColumn removedColumn)` Removes the given ValueExpressionColumn and its value from the given insert statement
`static void` `removeTableFromStatement(QueryInsertStatement statement)` Removes the target table from the given statement.
`static void` `replaceColumn(QueryInsertStatement insertStmt, ValueExpressionColumn oldColumn, ValueExpressionColumn newColumn)` Replaces an existing column in the insert statement with a new column.
`static void` `replaceStatementContents(QueryInsertStatement oldStmt, QueryInsertStatement newStmt)` Replaces the containments in one insert statement with the containments in another insert statement
`static void` `setTargetTable(QueryInsertStatement statement, TableInDatabase targetTable)` Sets the target TableExpression of the given Insert statement
`static void` `updateInsertValueForColumn(QueryInsertStatement insertStmt, ValueExpressionColumn column, QueryValueExpression valueExpr)` Updates the insert value of the column in the given insert statement.

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

Constructor Detail

### InsertHelper

    public InsertHelper()

Method Detail

### addColumn

    public static void addColumn(org.eclipse.emf.edit.domain.EditingDomain editDomain,
                                 QueryInsertStatement statement,
                                 Column column)

  Adds the given column to the target list of columns in the given insert statement. If the statement does not have a source query , then a default insert value is set up for the added column, in the insert row.

  Parameters:
    `editDomain` - the current editing domain (command processor)
    `statement` - the statement to which the column is added
    `column` - the column being added

### removeColumn

    public static void removeColumn(QueryInsertStatement statement,
                                    Column column)

  Removes the given Column and its value from the given insert statement

  Parameters:
    `statement` - the given insert statement
    `column` - the column to be removed

### refresh

    public static void refresh(QueryInsertStatement insert)

  Temporary to method to refresh the viewers in cases where notification does not work

  Parameters:
    `insert` -

### removeColumn

    public static void removeColumn(QueryInsertStatement statement,
                                    ValueExpressionColumn removedColumn)

  Removes the given ValueExpressionColumn and its value from the given insert statement

  Parameters:
    `statement` - the given insert statement
    `removedColumn` - the ValueExpressionColumn to be removed

### addDefaultInsertValue

    public static void addDefaultInsertValue(org.eclipse.emf.edit.domain.EditingDomain editDomain,
                                             QueryInsertStatement statement,
                                             Column column)

  Adds a default value for the given column in the given insert statement.

  Parameters:
    `editDomain` - the current editing domain (command processor)
    `statement` - the insert statement
    `colun` - the column for which the value is to be added

### addInsertQuery

    public static void addInsertQuery(QueryInsertStatement insertStmt)

  Adds an empty query expresion to the insert statement.

  Parameters:
    `insertStmt` - the statement to be modified

### clearStatementContents

    public static void clearStatementContents(QueryInsertStatement stmt)

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

### removeAllColumnsAndValues

    public static void removeAllColumnsAndValues(QueryInsertStatement stmt)

### updateInsertValueForColumn

    public static void updateInsertValueForColumn(QueryInsertStatement insertStmt,
                                                  ValueExpressionColumn column,
                                                  QueryValueExpression valueExpr)

  Updates the insert value of the column in the given insert statement.

  Parameters:
    `insertStmt` - the insert statement to be updated
    `column` - the column for which the value is updated
    `valueExpr` - the new value

### addInsertColumnValuePair

    public static void addInsertColumnValuePair(QueryInsertStatement insertStmt,
                                                ValueExpressionColumn column,
                                                QueryValueExpression valueExpr)

  Adds the given column and value to the given insert statement.

  Parameters:
    `insertStmt` - the insert statement , to which the column and the value are added
    `column` - the column being added
    `valueExpr` - the value for the column

### replaceColumn

    public static void replaceColumn(QueryInsertStatement insertStmt,
                                     ValueExpressionColumn oldColumn,
                                     ValueExpressionColumn newColumn)

  Replaces an existing column in the insert statement with a new column.

  Parameters:
    `insertStmt` - the insert statement to be modified
    `oldColumn` - the column being replaced
    `newColumn` - the column which replaces the existing column

### getColumnExpressionForName

    public static ValueExpressionColumn getColumnExpressionForName(QueryInsertStatement insertStmt,
                                                                   java.lang.String columnName)

  Returns the SQLValueExpressionColumn in the givern insert statement, which has the given name.

  Parameters:
    `insertStmt` - the insert statment to search on
    `columnName` - the column name to search for
  Returns:
    the SQLValueExpressionColumn matching the given name or null if there is no match

### getInsertValueforColumn

    public static QueryValueExpression getInsertValueforColumn(QueryInsertStatement insertStmt,
                                                               ValueExpressionColumn colExpr)

  Returns the SQLValueExpression from the first row of insert values in the given statement, corresponding to the given column,

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

### addOrReplaceTargetTable

    public static void addOrReplaceTargetTable(TableInDatabase targetTable,
                                               QueryInsertStatement stmt)

  Adds or replaces the target table in the given statement with the given table expression.

  Parameters:
    `targetTable` - the new table to use
    `stmt` - the statement to modify

### removeTableFromStatement

    public static void removeTableFromStatement(QueryInsertStatement statement)

  Removes the target table from the given statement.

  Parameters:
    `statement` - the statement to modify

### replaceStatementContents

    public static void replaceStatementContents(QueryInsertStatement oldStmt,
                                                QueryInsertStatement newStmt)

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

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

### setTargetTable

    public static void setTargetTable(QueryInsertStatement statement,
                                      TableInDatabase targetTable)

  Sets the target TableExpression of the given Insert statement

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