public class MergeUpsert extends Object implements IUpsert
A batch-able upsert strategy that relies on the SQL Merge statement.
Sample Generated SQL:
MERGE INTO tableName target USING (VALUES (?)) source(ID) ON target.ID=source.ID
WHEN NOT MATCHED THEN INSERT (col1, col2, col3) VALUES (?, ?, ?)
WHEN MATCHED THEN UPDATE SET SET col1=?, col2=?, col3=?;
Constructor and Description |
---|
MergeUpsert() |
Modifier and Type | Method and Description |
---|---|
void |
addBatch() |
void |
addExceptionProperties(DataException exception) |
MergeUpsert |
clone() |
void |
close() |
void |
executeBatch() |
void |
executeUpdate() |
String |
getMergeCondition() |
String |
getMergeSql() |
PreparedStatement |
getMergeStatement() |
boolean |
isBatchSupported() |
boolean |
isDebug()
Indicates if the generated SQL should be logged (default false).
|
boolean |
isTerminateWithSemicolon() |
void |
prepare(JdbcUpsertWriter writer,
Record record) |
MergeUpsert |
setDebug(boolean debug)
Set to
true to log generated SQL (default false). |
MergeUpsert |
setMergeCondition(String mergeCondition) |
MergeUpsert |
setTerminateWithSemicolon(boolean terminateWithSemicolon) |
void |
setValues(JdbcUpsertWriter writer,
Record record) |
public String getMergeSql()
public PreparedStatement getMergeStatement()
public String getMergeCondition()
public MergeUpsert setMergeCondition(String mergeCondition)
public boolean isTerminateWithSemicolon()
public MergeUpsert setTerminateWithSemicolon(boolean terminateWithSemicolon)
public boolean isDebug()
IUpsert
public MergeUpsert setDebug(boolean debug)
IUpsert
true
to log generated SQL (default false).public void prepare(JdbcUpsertWriter writer, Record record) throws Throwable
public void setValues(JdbcUpsertWriter writer, Record record) throws Throwable
public void executeUpdate() throws Throwable
executeUpdate
in interface IUpsert
Throwable
public boolean isBatchSupported()
isBatchSupported
in interface IUpsert
public void addBatch() throws Throwable
public void executeBatch() throws Throwable
executeBatch
in interface IUpsert
Throwable
public MergeUpsert clone()
public void close() throws Throwable
public void addExceptionProperties(DataException exception)
addExceptionProperties
in interface IUpsert
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.