Package liquibase.statement
Class ExecutablePreparedStatementBase
- java.lang.Object
-
- liquibase.statement.ExecutablePreparedStatementBase
-
- All Implemented Interfaces:
ExecutablePreparedStatement
,SqlStatement
- Direct Known Subclasses:
BatchDmlExecutablePreparedStatement
,InsertExecutablePreparedStatement
,UpdateExecutablePreparedStatement
public abstract class ExecutablePreparedStatementBase extends Object implements ExecutablePreparedStatement
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
ExecutablePreparedStatementBase.LOBContent<T>
-
Field Summary
Fields Modifier and Type Field Description protected static ResourceBundle
coreBundle
protected Database
database
-
Fields inherited from interface liquibase.statement.SqlStatement
EMPTY_SQL_STATEMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExecutablePreparedStatementBase(Database database, String catalogName, String schemaName, String tableName, List<? extends ColumnConfig> columns, ChangeSet changeSet, ResourceAccessor resourceAccessor)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface liquibase.statement.SqlStatement
continueOnError
-
-
-
-
Field Detail
-
coreBundle
protected static ResourceBundle coreBundle
-
database
protected Database database
-
-
Constructor Detail
-
ExecutablePreparedStatementBase
protected ExecutablePreparedStatementBase(Database database, String catalogName, String schemaName, String tableName, List<? extends ColumnConfig> columns, ChangeSet changeSet, ResourceAccessor resourceAccessor)
-
-
Method Detail
-
createStream
protected static InputStream createStream(InputStream in)
-
execute
public void execute(PreparedStatementFactory factory) throws DatabaseException
Description copied from interface:ExecutablePreparedStatement
Executes the prepared statement created by the given factory.- Specified by:
execute
in interfaceExecutablePreparedStatement
- Parameters:
factory
- a factory for creating aPreparedStatement
object.- Throws:
DatabaseException
- if an exception occurs while executing the prepared statement.
-
getCachedStatement
protected PreparedStatement getCachedStatement(String sql)
-
executePreparedStatement
protected void executePreparedStatement(PreparedStatement stmt) throws SQLException
- Throws:
SQLException
-
attachParams
protected void attachParams(List<? extends ColumnConfig> cols, PreparedStatement stmt) throws SQLException, DatabaseException
Sets the list of bind variables for the execution of a DML statement- Parameters:
cols
- 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 abstract String generateSql(List<ColumnConfig> cols)
-
applyColumnParameter
protected void applyColumnParameter(PreparedStatement stmt, int i, ColumnConfig col) throws SQLException, DatabaseException
Sets a single bind variable for a statement to its designated value- Parameters:
stmt
- the PreparedStatement whose parameter is to be seti
- the parameter index (first bind variable is 1)col
- a ColumnConfig with information about the column, its type, and the desired value- 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
-
toBinaryStream
protected ExecutablePreparedStatementBase.LOBContent<InputStream> toBinaryStream(String valueLobFile) throws LiquibaseException, IOException
- Throws:
LiquibaseException
IOException
-
toCharacterStream
protected ExecutablePreparedStatementBase.LOBContent<Reader> toCharacterStream(String valueLobFile, String encoding) throws IOException, LiquibaseException
- Throws:
IOException
LiquibaseException
-
getResourceAsStream
protected InputStream getResourceAsStream(String valueLobFile) throws IOException
- Throws:
IOException
-
skipOnUnsupported
public boolean skipOnUnsupported()
- Specified by:
skipOnUnsupported
in interfaceSqlStatement
-
getCatalogName
public String getCatalogName()
-
getSchemaName
public String getSchemaName()
-
getTableName
public String getTableName()
-
getColumns
public List<? extends ColumnConfig> getColumns()
-
getChangeSet
public ChangeSet getChangeSet()
-
getResourceAccessor
public ResourceAccessor getResourceAccessor()
-
getContentLength
protected long getContentLength(InputStream in) throws IOException
- Throws:
IOException
-
getContentLength
protected long getContentLength(Reader reader) throws IOException
- Throws:
IOException
-
-