public abstract class CreateDatabaseObjectsAction extends JDBCAction
NOLOG
CONTINUE_ON_ERROR, m_defaultOptions, m_options
APPEND_LOG, DATABASE_TYPE, DATABASE_URL, DB_USER_NAME, DB_USER_PASSWORD, DOMAIN_TYPE, ENABLE_SSL_SUPPORT, FOR_SCHEMA_UPGRADE, IFS_DOMAIN_DISPLAY_NAME, IFS_DOMAIN_NAME, IFS_SCHEMA_NAME, IFS_SCHEMA_PASSWORD, IFS_SERVICE_NAME, IFS_USER_NAME, IFS_USER_PASSWORD, INCLUDE_PATH, INITIAL_CONTEXT_FACTORY, LDAP_URL_DAS_LOOKUP, LDAP_USER_NAME, LDAP_USER_PASSWORD, OUTPUT_FILE, PARAMETER_FILE, REGISTRY, SCHEMA_VERSION_KEY, SECURITY_PROTOCOL_NAME, SERVICE_CONFIGURATION_NAME
Constructor and Description |
---|
CreateDatabaseObjectsAction() |
Modifier and Type | Method and Description |
---|---|
protected void |
analyze(Connection conn,
String schemaName)
Analyze a schema.
|
protected void |
analyzeTable(Connection conn,
String schemaName,
String tableName)
Analyze a table in a schema.
|
protected void |
closeResultSet(ResultSet rset)
Close a ResultSet, ignoring any errors.
|
protected void |
closeStatement(Statement stmt)
Close a Statement, ignoring any errors.
|
protected boolean |
columnExists(Connection conn,
String tableName,
String columnName)
Return true if the specified column exists in the specified table.
|
protected void |
commit(Connection conn)
Issue a commit
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String[] columns,
boolean isUnique)
Create an index on n columns of a table.
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String[] columns,
boolean isUnique,
boolean dropAndRetryIfExists,
boolean ignoreIfEquivalent)
Create an index on n columns of a table.
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String columnName,
boolean isUnique)
Create an index on a column of a table.
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String columnName,
boolean isUnique,
boolean dropAndRetryIfExists,
boolean ignoreIfEquivalent)
Create an index on a column of a table.
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String columnName1,
String columnName2,
boolean isUnique)
Create an index on 2 columns of a table.
|
protected void |
createIndex(Connection conn,
String indexName,
String tableName,
String columnName1,
String columnName2,
boolean isUnique,
boolean dropAndRetryIfExists,
boolean ignoreIfEquivalent)
Create an index on 2 columns of a table.
|
protected void |
createSequence(Connection conn,
String seqName,
int initialValue,
int cacheSize)
Create a sequence.
|
protected void |
createTable(Connection conn,
String tableName,
String createStmt)
Create a table.
|
protected void |
createView(Connection conn,
String viewName,
String createStmt)
Create a view.
|
protected void |
dropIndex(Connection conn,
String indexName)
Drop an index
|
protected void |
dropSequence(Connection conn,
String seqName)
Drop a sequence
|
protected void |
dropTable(Connection conn,
String tableName)
Drop a table.
|
protected void |
dropView(Connection conn,
String viewName)
Drop a view.
|
protected void |
executeStatement(Connection conn,
String stmtString)
Execute any SQL statement
|
protected int |
executeUpdate(Connection conn,
String stmtString)
Execute an update statement.
|
void |
failed(Throwable error)
Does nothing.
|
protected long |
getNextSequenceValue(Connection conn,
String seqName)
Get a value from a sequence.
|
String |
getSchemaName()
Gets the schema name.
|
protected String |
getTimestamp()
Gets a timestamp to use in the logs.
|
protected boolean |
isValidConnection(Connection conn)
Test validity of a Connection
|
protected void |
log(String msg)
Add message to the log.
|
protected void |
log(Throwable t)
Add message to the log.
|
protected void |
printStackTrace(Throwable e)
Add stacktrace to the log.
|
protected void |
rollback(Connection conn)
Issue a rollback
|
protected boolean |
rowExists(Connection conn,
String tableName,
String condition)
Return true if there is a row that meets the specified condition
for the specified table.
|
protected boolean |
rowExists(Connection conn,
String tableName,
String condition,
boolean errorValue)
Return true if there is a row that meets the specified condition
for the specified table.
|
void |
stop()
Does nothing.
|
protected boolean |
tableExists(Connection conn,
String tableName)
Return true if the specified table exists.
|
execute, perform, setDatabaseUrl, setPassword, setUser
getDescription, getName, getValue, isContinueOnError, isPostgres, putValue, setDefaultOptions, setDescription, setName, setOptions
public void stop()
public void failed(Throwable error)
error
- the error that occurred.public String getSchemaName()
protected void createTable(Connection conn, String tableName, String createStmt) throws SQLException
conn
- the database connectiontableName
- the name of the tablecreateStmt
- the CREATE TABLE sql stringSQLException
- if the operation failsprotected void createView(Connection conn, String viewName, String createStmt) throws SQLException
conn
- the database connectionviewName
- the name of the viewcreateStmt
- the CREATE VIEW sql stringSQLException
- if the operation failsprotected void dropTable(Connection conn, String tableName) throws SQLException
conn
- the database connectiontableName
- the name of the tableSQLException
- if the operation failsprotected void dropView(Connection conn, String viewName) throws SQLException
conn
- the database connectionviewName
- the name of the tableSQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String columnName, boolean isUnique) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumnName
- the name of the columnisUnique
- is the index to be a unique index?SQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String columnName, boolean isUnique, boolean dropAndRetryIfExists, boolean ignoreIfEquivalent) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumnName
- the name of the columnisUnique
- is the index to be a unique index?dropAndRetryIfExists
- if index name exists, should it be
dropped and creation retried?ignoreIfEquivalent
- if another index exists on the
specified columns, should the
exception be ignored?SQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String columnName1, String columnName2, boolean isUnique) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumnName1
- the name of the first columncolumnName2
- the name of the second columnisUnique
- is the index to be a unique index?SQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String columnName1, String columnName2, boolean isUnique, boolean dropAndRetryIfExists, boolean ignoreIfEquivalent) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumnName1
- the name of the first columncolumnName2
- the name of the second columnisUnique
- is the index to be a unique index?dropAndRetryIfExists
- if index name exists, should it be
dropped and creation retried?ignoreIfEquivalent
- if another index exists on the
specified columns, should the
exception be ignored?SQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String[] columns, boolean isUnique) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumns
- the names of the columnsisUnique
- is the index to be a unique index?SQLException
- if the operation failsprotected void createIndex(Connection conn, String indexName, String tableName, String[] columns, boolean isUnique, boolean dropAndRetryIfExists, boolean ignoreIfEquivalent) throws SQLException
conn
- the database connectionindexName
- the name of the indextableName
- the name of the tablecolumns
- the names of the columnsisUnique
- is the index to be a unique index?dropAndRetryIfExists
- if index name exists, should it be
dropped and creation retried?ignoreIfEquivalent
- if another index exists on the
specified columns, should the
exception be ignored?SQLException
- if the operation failsprotected void dropIndex(Connection conn, String indexName) throws SQLException
conn
- the database connectionindexName
- the name of the indexSQLException
- if the operation failsprotected void createSequence(Connection conn, String seqName, int initialValue, int cacheSize) throws SQLException
conn
- the database connectionseqName
- the name of the seqeunceinitialValue
- the initial valuecacheSize
- the cache sizeSQLException
- if the operation failsprotected void dropSequence(Connection conn, String seqName) throws SQLException
conn
- the database connectionseqName
- the name of the seqeunceSQLException
- if the operation failsprotected long getNextSequenceValue(Connection conn, String seqName) throws SQLException
conn
- the database connectionseqName
- the sequenceSQLException
- if the operation failsprotected void executeStatement(Connection conn, String stmtString) throws SQLException
conn
- the database connectionstmtString
- the SQL to executeSQLException
- if the operation failsprotected int executeUpdate(Connection conn, String stmtString) throws SQLException
conn
- the database connectionstmtString
- the SQL to executeSQLException
- if the operation failsprotected boolean rowExists(Connection conn, String tableName, String condition) throws SQLException
conn
- the database connectiontableName
- the table namecondition
- the where clauseSQLException
- if the operation failsprotected boolean rowExists(Connection conn, String tableName, String condition, boolean errorValue)
conn
- the database connectiontableName
- the table namecondition
- the where clauseerrorValue
- the value to return if the SQL failsSQLException
- if the operation failsprotected boolean tableExists(Connection conn, String tableName) throws SQLException
conn
- the database connectiontableName
- the table nameSQLException
- if the operation failsprotected boolean columnExists(Connection conn, String tableName, String columnName) throws SQLException
conn
- the database connectiontableName
- the table namecolumnName
- the column nameSQLException
- if the operation failsprotected void analyze(Connection conn, String schemaName) throws SQLException
conn
- the database connectionschemaName
- the name of the schema to analyzeSQLException
- if the operation failsprotected void analyzeTable(Connection conn, String schemaName, String tableName) throws SQLException
conn
- the database connectionschemaName
- the name of the schema containing the tabletableName
- the name of the table to analyzeSQLException
- if the operation failsprotected void commit(Connection conn) throws SQLException
conn
- the database connectionSQLException
- if the operation failsprotected void rollback(Connection conn) throws SQLException
conn
- the database connectionSQLException
- if the operation failsprotected boolean isValidConnection(Connection conn)
conn
- the database connectionprotected void closeResultSet(ResultSet rset)
rset
- the ResultSet to closeprotected void closeStatement(Statement stmt)
stmt
- the statement to closeprotected void log(String msg)
msg
- the message to logprotected void log(Throwable t)
t
- the throwable to logprotected void printStackTrace(Throwable e)
e
- the Throwable to logprotected String getTimestamp()
Copyright © 2023. All rights reserved.