Class Merge
java.lang.Object
com.northconcepts.datapipeline.jdbc.sql.SqlPart
com.northconcepts.datapipeline.jdbc.sql.merge.Merge
Builds a MERGE statement that updates the target row when the ON condition matches and inserts one otherwise;
the target table is aliased
target.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddInsertValue(String columnName, Object value, boolean isInsert) Adds a column and its parameter value to the INSERT clause, rendered ascolumn=?unlessisInsertis true.addInsertValues(String... columnNames) Adds columns with null parameter values to the INSERT clause.addUpdateValue(String columnName) Adds acolumn=?assignment with a null parameter value to the UPDATE SET clause.addUpdateValue(String columnName, Object value, boolean isInsert) Adds a column and its parameter value to the UPDATE SET clause, rendered ascolumn=?unlessisInsertis true.voidcollectParameterValues(List<Object> values) Appends the values for this part's?parameters to the list in order; adds nothing by default.voidcollectSqlFragment(CodeWriter writer) Writes this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.Returns the ON condition that decides between updating and inserting.getUsing()Returns the strategy that renders the USING clause ornullif none is set.voidsetCondition(String condition) Sets the ON condition that decides between updating and inserting.setPretty(boolean pretty) Indicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false).setUsing(IMergeUsing using) Sets the strategy that renders the USING clause, such asMergeUsing.VALUES; required before generating the SQL.Methods inherited from class com.northconcepts.datapipeline.jdbc.sql.SqlPart
getParameterValues, getSqlFragment, isPretty, printSqlParts, toString
-
Constructor Details
-
Merge
-
-
Method Details
-
setPretty
Description copied from class:SqlPartIndicates ifSqlPart.getSqlFragment()adds line breaks and indentation instead of using one line (default is false). -
getCondition
Returns the ON condition that decides between updating and inserting. -
setCondition
Sets the ON condition that decides between updating and inserting. -
addInsertValue
Adds a column and its parameter value to the INSERT clause, rendered ascolumn=?unlessisInsertis true. -
addInsertValues
Adds columns with null parameter values to the INSERT clause. -
addUpdateValue
Adds a column and its parameter value to the UPDATE SET clause, rendered ascolumn=?unlessisInsertis true. -
addUpdateValue
Adds acolumn=?assignment with a null parameter value to the UPDATE SET clause. -
addValue
-
getTarget
-
getUsing
Returns the strategy that renders the USING clause ornullif none is set. -
setUsing
Sets the strategy that renders the USING clause, such asMergeUsing.VALUES; required before generating the SQL. -
collectSqlFragment
Description copied from class:SqlPartWrites this part's SQL to the writer; used bySqlPart.getSqlFragment()and by enclosing parts.- Specified by:
collectSqlFragmentin classSqlPart
-
collectParameterValues
Description copied from class:SqlPartAppends the values for this part's?parameters to the list in order; adds nothing by default.- Overrides:
collectParameterValuesin classSqlPart
-