@Internal public final class InsertOrUpdateJdbcExecutor<R,K,V> extends Object implements JdbcBatchStatementExecutor<R>
JdbcBatchStatementExecutor
that provides upsert semantics by updating row if it exists
and inserting otherwise. Used in Table API.Constructor and Description |
---|
InsertOrUpdateJdbcExecutor(String existSQL,
String insertSQL,
String updateSQL,
JdbcStatementBuilder<K> existSetter,
JdbcStatementBuilder<V> insertSetter,
JdbcStatementBuilder<V> updateSetter,
java.util.function.Function<R,K> keyExtractor,
java.util.function.Function<R,V> valueExtractor) |
Modifier and Type | Method and Description |
---|---|
void |
addToBatch(R record) |
void |
closeStatements()
Close JDBC related statements.
|
void |
executeBatch()
Submits a batch of commands to the database for execution.
|
void |
prepareStatements(Connection connection)
Create statements from connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
keyed, simple
public InsertOrUpdateJdbcExecutor(@Nonnull String existSQL, @Nonnull String insertSQL, @Nonnull String updateSQL, @Nonnull JdbcStatementBuilder<K> existSetter, @Nonnull JdbcStatementBuilder<V> insertSetter, @Nonnull JdbcStatementBuilder<V> updateSetter, @Nonnull java.util.function.Function<R,K> keyExtractor, @Nonnull java.util.function.Function<R,V> valueExtractor)
public void prepareStatements(Connection connection) throws SQLException
JdbcBatchStatementExecutor
prepareStatements
in interface JdbcBatchStatementExecutor<R>
SQLException
public void addToBatch(R record)
addToBatch
in interface JdbcBatchStatementExecutor<R>
public void executeBatch() throws SQLException
JdbcBatchStatementExecutor
executeBatch
in interface JdbcBatchStatementExecutor<R>
SQLException
public void closeStatements() throws SQLException
JdbcBatchStatementExecutor
closeStatements
in interface JdbcBatchStatementExecutor<R>
SQLException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.