public abstract class BaseDBProcess extends Object implements DBProcess
Modifier and Type | Field and Description |
---|---|
protected Connection |
connection |
Constructor and Description |
---|
BaseDBProcess() |
Modifier and Type | Method and Description |
---|---|
protected void |
addIndexes(Connection connection,
List<IndexMetadata> indexMetadatas) |
protected void |
alterColumnName(String tableName,
String oldColumnName,
String newColumnDefinition) |
protected void |
alterColumnType(String tableName,
String columnName,
String newColumnType) |
protected void |
alterTableAddColumn(String tableName,
String columnName,
String columnType) |
protected void |
alterTableDropColumn(String tableName,
String columnName) |
protected void |
alterTableName(String tableName,
String newTableName) |
protected boolean |
doHasTable(String tableName)
Deprecated.
As of Cavanaugh (7.4.x), replaced by
hasTable(String) |
protected List<IndexMetadata> |
dropIndexes(String tableName,
String columnName) |
protected void |
dropTable(String tableName) |
protected Connection |
getConnection() |
protected String[] |
getPrimaryKeyColumnNames(Connection connection,
String tableName) |
protected boolean |
hasColumn(String tableName,
String columnName) |
protected boolean |
hasColumnType(String tableName,
String columnName,
String columnType) |
protected boolean |
hasIndex(String tableName,
String indexName) |
protected boolean |
hasRows(Connection connection,
String tableName) |
protected boolean |
hasRows(String tableName) |
protected boolean |
hasTable(String tableName) |
protected void |
process(com.liferay.petra.function.UnsafeConsumer<Long,Exception> unsafeConsumer) |
protected void |
processConcurrently(String sql,
String updateSQL,
com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction,
com.liferay.petra.function.UnsafeBiConsumer<Object[],PreparedStatement,Exception> unsafeBiConsumer,
String exceptionMessage) |
protected void |
processConcurrently(String sql,
com.liferay.petra.function.UnsafeConsumer<PreparedStatement,Exception> unsafeConsumer,
String updateSQL,
com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction,
com.liferay.petra.function.UnsafeBiConsumer<Object[],PreparedStatement,Exception> unsafeBiConsumer,
String exceptionMessage) |
protected void |
processConcurrently(String sql,
com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction,
com.liferay.petra.function.UnsafeConsumer<Object[],Exception> unsafeConsumer,
String exceptionMessage) |
protected <T> void |
processConcurrently(T[] array,
com.liferay.petra.function.UnsafeConsumer<T,Exception> unsafeConsumer,
String exceptionMessage) |
protected void |
removePrimaryKey(String tableName) |
void |
runSQL(Connection connection,
String template) |
void |
runSQL(DBTypeToSQLMap dbTypeToSQLMap) |
void |
runSQL(String template) |
void |
runSQL(String[] templates) |
void |
runSQLTemplate(String path) |
void |
runSQLTemplate(String path,
boolean failOnError) |
void |
runSQLTemplateString(String template,
boolean failOnError) |
public void runSQL(Connection connection, String template) throws IOException, SQLException
public void runSQL(DBTypeToSQLMap dbTypeToSQLMap) throws IOException, SQLException
public void runSQL(String template) throws IOException, SQLException
public void runSQL(String[] templates) throws IOException, SQLException
public void runSQLTemplate(String path) throws IOException, javax.naming.NamingException, SQLException
runSQLTemplate
in interface DBProcess
IOException
javax.naming.NamingException
SQLException
public void runSQLTemplate(String path, boolean failOnError) throws IOException, javax.naming.NamingException, SQLException
runSQLTemplate
in interface DBProcess
IOException
javax.naming.NamingException
SQLException
public void runSQLTemplateString(String template, boolean failOnError) throws IOException, javax.naming.NamingException, SQLException
runSQLTemplateString
in interface DBProcess
IOException
javax.naming.NamingException
SQLException
protected void addIndexes(Connection connection, List<IndexMetadata> indexMetadatas) throws IOException, SQLException
IOException
SQLException
protected void alterColumnName(String tableName, String oldColumnName, String newColumnDefinition) throws Exception
Exception
protected void alterColumnType(String tableName, String columnName, String newColumnType) throws Exception
Exception
protected void alterTableAddColumn(String tableName, String columnName, String columnType) throws Exception
Exception
protected void alterTableDropColumn(String tableName, String columnName) throws Exception
Exception
protected void alterTableName(String tableName, String newTableName) throws Exception
Exception
@Deprecated protected boolean doHasTable(String tableName) throws Exception
hasTable(String)
Exception
protected List<IndexMetadata> dropIndexes(String tableName, String columnName) throws Exception
Exception
protected void dropTable(String tableName) throws Exception
Exception
protected Connection getConnection() throws Exception
Exception
protected String[] getPrimaryKeyColumnNames(Connection connection, String tableName) throws SQLException
SQLException
protected boolean hasColumn(String tableName, String columnName) throws Exception
Exception
protected boolean hasColumnType(String tableName, String columnName, String columnType) throws Exception
Exception
protected boolean hasIndex(String tableName, String indexName) throws Exception
Exception
protected boolean hasRows(Connection connection, String tableName)
protected boolean hasRows(String tableName) throws Exception
Exception
protected boolean hasTable(String tableName) throws Exception
Exception
protected void process(com.liferay.petra.function.UnsafeConsumer<Long,Exception> unsafeConsumer) throws Exception
Exception
protected void processConcurrently(String sql, String updateSQL, com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction, com.liferay.petra.function.UnsafeBiConsumer<Object[],PreparedStatement,Exception> unsafeBiConsumer, String exceptionMessage) throws Exception
Exception
protected void processConcurrently(String sql, com.liferay.petra.function.UnsafeConsumer<PreparedStatement,Exception> unsafeConsumer, String updateSQL, com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction, com.liferay.petra.function.UnsafeBiConsumer<Object[],PreparedStatement,Exception> unsafeBiConsumer, String exceptionMessage) throws Exception
Exception
protected void processConcurrently(String sql, com.liferay.petra.function.UnsafeFunction<ResultSet,Object[],Exception> unsafeFunction, com.liferay.petra.function.UnsafeConsumer<Object[],Exception> unsafeConsumer, String exceptionMessage) throws Exception
Exception
protected <T> void processConcurrently(T[] array, com.liferay.petra.function.UnsafeConsumer<T,Exception> unsafeConsumer, String exceptionMessage) throws Exception
Exception
protected void removePrimaryKey(String tableName) throws Exception
Exception