Package liquibase.statement
Class BatchDmlExecutablePreparedStatement
- java.lang.Object
-
- liquibase.statement.ExecutablePreparedStatementBase
-
- liquibase.statement.BatchDmlExecutablePreparedStatement
-
- All Implemented Interfaces:
ExecutablePreparedStatement,SqlStatement
public class BatchDmlExecutablePreparedStatement extends ExecutablePreparedStatementBase
Performance-optimised version ofExecutablePreparedStatementBase. JDBC batching collects several executions of DML statements and waits until a certain number of commands has been collected. Then, it sends all of them to the RDBMS in a single call.Statement.executeBatch()saves many round-trips between client and database, often speeding up bulk inserts/updates dramatically if the JDBC driver supports it.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class liquibase.statement.ExecutablePreparedStatementBase
ExecutablePreparedStatementBase.LOBContent<T>
-
-
Field Summary
-
Fields inherited from class liquibase.statement.ExecutablePreparedStatementBase
coreBundle, database
-
Fields inherited from interface liquibase.statement.SqlStatement
EMPTY_SQL_STATEMENT
-
-
Constructor Summary
Constructors Constructor Description BatchDmlExecutablePreparedStatement(Database database, String catalogName, String schemaName, String tableName, List<LoadDataColumnConfig> columns, ChangeSet changeSet, ResourceAccessor resourceAccessor, List<ExecutablePreparedStatementBase> statements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidattachParams(List<? extends ColumnConfig> ignored, PreparedStatement stmt)Sets the list of bind variables for the execution of a DML statementbooleancontinueOnError()protected voidexecutePreparedStatement(PreparedStatement stmt)protected StringgenerateSql(List<ColumnConfig> cols)List<ExecutablePreparedStatementBase>getIndividualStatements()Returns the individual statements that are currently store in this batch.-
Methods inherited from class liquibase.statement.ExecutablePreparedStatementBase
applyColumnParameter, createStream, execute, getCachedStatement, getCatalogName, getChangeSet, getColumns, getContentLength, getContentLength, getResourceAccessor, getResourceAsStream, getSchemaName, getTableName, skipOnUnsupported, toBinaryStream, toCharacterStream
-
-
-
-
Constructor Detail
-
BatchDmlExecutablePreparedStatement
public BatchDmlExecutablePreparedStatement(Database database, String catalogName, String schemaName, String tableName, List<LoadDataColumnConfig> columns, ChangeSet changeSet, ResourceAccessor resourceAccessor, List<ExecutablePreparedStatementBase> statements)
-
-
Method Detail
-
getIndividualStatements
public List<ExecutablePreparedStatementBase> getIndividualStatements()
Returns the individual statements that are currently store in this batch.- Returns:
- the List of the stored statements (may be empty if none are stored)
-
attachParams
protected void attachParams(List<? extends ColumnConfig> ignored, PreparedStatement stmt) throws SQLException, DatabaseException
Description copied from class:ExecutablePreparedStatementBaseSets the list of bind variables for the execution of a DML statement- Overrides:
attachParamsin classExecutablePreparedStatementBase- Parameters:
ignored- a list of columns with their designated valuesstmt- the PreparedStatement to which the values are to be attached- Throws:
SQLException- if JDBC objects to a setting (non-existent bind number, wrong column type etc.)DatabaseException- if an I/O error occurs during the read of LOB values
-
generateSql
protected String generateSql(List<ColumnConfig> cols)
- Specified by:
generateSqlin classExecutablePreparedStatementBase
-
executePreparedStatement
protected void executePreparedStatement(PreparedStatement stmt) throws SQLException
- Overrides:
executePreparedStatementin classExecutablePreparedStatementBase- Throws:
SQLException
-
continueOnError
public boolean continueOnError()
-
-