|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.dna.common.jdbc.util.DatabaseUtil
public class DatabaseUtil

Database related utilities
| Method Summary | ||
|---|---|---|
static BestRowIdentifierScopeType |
getBestRowIdentifierScopeType(Integer type)
Returns BestRowIdentifierScopeType or null |
|
static Boolean |
getBoolean(ResultSet resultSet,
int columnIndex)
Returns boolean with respect to NULL values (ResultSet.wasNull()) |
|
static Boolean |
getBoolean(ResultSet resultSet,
int columnIndex,
boolean failOnError)
Returns boolean with respect to NULL values (ResultSet.wasNull()) |
|
static Boolean |
getBoolean(ResultSet resultSet,
String columnName)
Returns boolean with respect to NULL values (ResultSet.wasNull()) |
|
static Boolean |
getBoolean(ResultSet resultSet,
String columnName,
boolean failOnError)
Returns boolean with respect to NULL values (ResultSet.wasNull()) |
|
static ColumnPseudoType |
getColumnPseudoType(Integer type)
Returns ColumnPseudoType or null |
|
static
|
getDatabaseMetadataProperty(DatabaseMetaData instance,
String methodName,
Logger traceLog)
Get simple database metadata for the getter method (no input parameters) |
|
static Double |
getDouble(ResultSet resultSet,
int columnIndex)
Returns double with respect to NULL values (ResultSet.wasNull()) |
|
static Double |
getDouble(ResultSet resultSet,
int columnIndex,
boolean failOnError)
Returns double with respect to NULL values (ResultSet.wasNull()) |
|
static Double |
getDouble(ResultSet resultSet,
String columnName)
Returns double with respect to NULL values (ResultSet.wasNull()) |
|
static Double |
getDouble(ResultSet resultSet,
String columnName,
boolean failOnError)
Returns double with respect to NULL values (ResultSet.wasNull()) |
|
static IndexType |
getIndexType(Integer type)
Returns IndexType or null |
|
static Integer |
getInteger(ResultSet resultSet,
int columnIndex)
Returns integer with respect to NULL values (ResultSet.wasNull()) |
|
static Integer |
getInteger(ResultSet resultSet,
int columnIndex,
boolean failOnError)
Returns integer with respect to NULL values (ResultSet.wasNull()) |
|
static Integer |
getInteger(ResultSet resultSet,
String columnName)
Returns integer with respect to NULL values (ResultSet.wasNull()) |
|
static Integer |
getInteger(ResultSet resultSet,
String columnName,
boolean failOnError)
Returns integer with respect to NULL values (ResultSet.wasNull()) |
|
static KeyDeferrabilityType |
getKeyDeferrabilityType(Integer type)
Returns KeyDeferrabilityType or null |
|
static KeyModifyRuleType |
getKeyModifyRuleType(Integer type)
Returns KeyModifyRuleType or null |
|
static Long |
getLong(ResultSet resultSet,
int columnIndex)
Returns long with respect to NULL values (ResultSet.wasNull()) |
|
static Long |
getLong(ResultSet resultSet,
int columnIndex,
boolean failOnError)
Returns long with respect to NULL values (ResultSet.wasNull()) |
|
static Long |
getLong(ResultSet resultSet,
String columnName)
Returns long with respect to NULL values (ResultSet.wasNull()) |
|
static Long |
getLong(ResultSet resultSet,
String columnName,
boolean failOnError)
Returns long with respect to NULL values (ResultSet.wasNull()) |
|
static NullabilityType |
getNullabilityType(Integer type)
Returns column nullability, or null |
|
static ParameterIoType |
getParameterIoType(Integer type)
Returns ParameterIoType based on type, or null |
|
static PrivilegeType |
getPrivilegeType(String type)
Returns PrivilegeType or null |
|
static ResultSetConcurrencyType |
getResultSetConcurrencyType(Integer type)
Returns ResultSetConcurrencyType or null |
|
static ResultSetHoldabilityType |
getResultSetHoldabilityType(Integer type)
Returns ResultSetHoldabilityType or null |
|
static ResultSetType |
getResultSetType(Integer type)
Returns ResultSetType or null |
|
static SearchabilityType |
getSearchabilityType(Integer type)
Returns SearchabilityType or null |
|
static SortSequenceType |
getSortSequenceType(String type)
Returns SortSequenceType or null |
|
static SQLStateType |
getSqlStateType(Integer type)
Returns SqlStateType based on type, or null |
|
static SqlType |
getSqlType(Integer type)
Returns SqlType based on data type, or null |
|
static String |
getStandardUserDefinedTypes()
Returns Standard UDT types as string |
|
static StoredProcedureResultType |
getStoredProcedureResultType(Integer type)
Returns SP result type based on PROCEDURE_TYPE |
|
static String |
getString(ResultSet resultSet,
int columnIndex)
Returns String with respect to NULL values (ResultSet.wasNull()) |
|
static String |
getString(ResultSet resultSet,
int columnIndex,
boolean failOnError)
Returns String with respect to NULL values (ResultSet.wasNull()) |
|
static String |
getString(ResultSet resultSet,
String columnName)
Returns String with respect to NULL values (ResultSet.wasNull()) |
|
static String |
getString(ResultSet resultSet,
String columnName,
boolean failOnError)
Returns String with respect to NULL values (ResultSet.wasNull()) |
|
static TransactionIsolationLevelType |
getTransactionIsolationLevelType(Integer type)
Returns transaction isolation level, or null |
|
static int[] |
getUserDefinedTypes(String userDefinedTypes)
Converts string array of UDT names to appropriate int array of UDT types specified in java.sql.Types |
|
static BestRowIdentifier |
populateBestRowIdentifier(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table best row identifier based on current record in result set; adds best row identifier to the table |
|
static Catalog |
populateCatalog(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates catalog based on current record in result set; adds catalog to the database |
|
static Set<ForeignKey> |
populateForeignKeys(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table's foreign keys based on ALL records in result set; adds fk columns to the table's foreing key |
|
static Set<Index> |
populateIndexes(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table's indexes based on ALL records in result set; adds columns to the table's index |
|
static PrimaryKey |
populatePrimaryKey(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table's primary key based on ALL records in result set; adds pk columns to the table's primary key |
|
static Schema |
populateSchema(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates schema based on current record in result set; adds schema to the database |
|
static SqlTypeInfo |
populateSqlTypeInfo(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates SQL type info based on current record in result set; adds SQL type info to the database |
|
static StoredProcedure |
populateStoredProcedure(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates stored procedure based on current record in result set; adds SP to the database |
|
static Parameter |
populateStoredProcedureParameter(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
StoredProcedure storedProcedure,
int ordinalPosition)
Creates stored procedure parameter based on current record in result set; adds SP parameter to the SP |
|
static Table |
populateTable(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates table based on current record in result set; adds table to the database |
|
static TableColumn |
populateTableColumn(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table column based on current record in result set; adds column to the table |
|
static Set<Privilege> |
populateTableColumnPrivileges(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table,
TableColumn column)
Creates table's column privileges based on ALL records in result set; |
|
static Set<Privilege> |
populateTablePrivileges(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table's privileges based on ALL records in result set; |
|
static TableType |
populateTableType(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates table types based on current record in result set; adds table types to the database |
|
static UserDefinedType |
populateUDT(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
Creates UDT based on current record in result set; adds UDT to the database |
|
static Attribute |
populateUDTAttribute(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
UserDefinedType udt)
Creates UDT attribute based on current record in result set; adds attribute to the UDT |
|
static TableColumn |
populateVersionColumn(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Creates table's version column (if pseudo) based on current record in result set; adds column to the table |
|
static void |
updateTableSuperTable(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
Updates table super table info based on current record in result set |
|
static void |
updateUDTSuperType(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
UserDefinedType udt)
Updates UDT super type info based on current record in result set |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static String getStandardUserDefinedTypes()
public static int[] getUserDefinedTypes(String userDefinedTypes)
userDefinedTypes - the string array of UDT names
public static Boolean getBoolean(ResultSet resultSet,
String columnName)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of column
SQLException
public static Boolean getBoolean(ResultSet resultSet,
String columnName,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of columnfailOnError - if true raises exception
SQLException
public static Boolean getBoolean(ResultSet resultSet,
int columnIndex)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of column
SQLException
public static Boolean getBoolean(ResultSet resultSet,
int columnIndex,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of columnfailOnError - if true raises exception
SQLException
public static Integer getInteger(ResultSet resultSet,
String columnName)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of column
SQLException
public static Integer getInteger(ResultSet resultSet,
String columnName,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of columnfailOnError - if true raises exception
SQLException
public static Integer getInteger(ResultSet resultSet,
int columnIndex)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of column
SQLException
public static Integer getInteger(ResultSet resultSet,
int columnIndex,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of columnfailOnError - if true raises exception
SQLException
public static Long getLong(ResultSet resultSet,
String columnName)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of column
SQLException
public static Long getLong(ResultSet resultSet,
String columnName,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of columnfailOnError - if true raises exception
SQLException
public static Long getLong(ResultSet resultSet,
int columnIndex)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of column
SQLException
public static Long getLong(ResultSet resultSet,
int columnIndex,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of columnfailOnError - if true raises exception
SQLException
public static Double getDouble(ResultSet resultSet,
String columnName)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of column
SQLException
public static Double getDouble(ResultSet resultSet,
String columnName,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of columnfailOnError - if true raises exception
SQLException
public static Double getDouble(ResultSet resultSet,
int columnIndex)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of column
SQLException
public static Double getDouble(ResultSet resultSet,
int columnIndex,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of columnfailOnError - if true raises exception
SQLException
public static String getString(ResultSet resultSet,
String columnName)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of column
SQLException
public static String getString(ResultSet resultSet,
String columnName,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnName - the name of columnfailOnError - if true raises exception
SQLException
public static String getString(ResultSet resultSet,
int columnIndex)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of column
SQLException
public static String getString(ResultSet resultSet,
int columnIndex,
boolean failOnError)
throws SQLException
resultSet - the result set to fetch fromcolumnIndex - the index of columnfailOnError - if true raises exception
SQLExceptionpublic static BestRowIdentifierScopeType getBestRowIdentifierScopeType(Integer type)
type - the best row identifier
public static ColumnPseudoType getColumnPseudoType(Integer type)
type - the column pseudo type
public static IndexType getIndexType(Integer type)
type - the index type
public static KeyDeferrabilityType getKeyDeferrabilityType(Integer type)
type - the key defferability type
public static KeyModifyRuleType getKeyModifyRuleType(Integer type)
type - the key modify rule type
public static NullabilityType getNullabilityType(Integer type)
type -
public static ParameterIoType getParameterIoType(Integer type)
type - i/o type
public static PrivilegeType getPrivilegeType(String type)
type - the privilege type
public static ResultSetConcurrencyType getResultSetConcurrencyType(Integer type)
type - the concurrency
public static ResultSetHoldabilityType getResultSetHoldabilityType(Integer type)
type - the holdability
public static ResultSetType getResultSetType(Integer type)
type - the result set type
public static SearchabilityType getSearchabilityType(Integer type)
type - the searchability
public static SortSequenceType getSortSequenceType(String type)
type - the sort sequence
public static SQLStateType getSqlStateType(Integer type)
type - the SQL state type
public static SqlType getSqlType(Integer type)
type - the SQL type
public static StoredProcedureResultType getStoredProcedureResultType(Integer type)
type - the stored procedure result type
public static TransactionIsolationLevelType getTransactionIsolationLevelType(Integer type)
type - the level type
public static Catalog populateCatalog(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static Schema populateSchema(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static TableType populateTableType(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static StoredProcedure populateStoredProcedure(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create SPresultSet - the stored procedure result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static Parameter populateStoredProcedureParameter(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
StoredProcedure storedProcedure,
int ordinalPosition)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasestoredProcedure - the owner stored procedureordinalPosition - the parameter ordinal position
Exception - if any error occurs and failOnError is true then generates exception
public static Table populateTable(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static TableColumn populateTableColumn(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static BestRowIdentifier populateBestRowIdentifier(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static PrimaryKey populatePrimaryKey(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static Set<ForeignKey> populateForeignKeys(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static Set<Index> populateIndexes(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static TableColumn populateVersionColumn(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static Set<Privilege> populateTablePrivileges(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner table
Exception - if any error occurs and failOnError is true then generates exception
public static Set<Privilege> populateTableColumnPrivileges(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table,
TableColumn column)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the owner tablecolumn - the table column
Exception - if any error occurs and failOnError is true then generates exception
public static SqlTypeInfo populateSqlTypeInfo(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static UserDefinedType populateUDT(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database)
throws Exception
factory - the model factory to create tableresultSet - the table result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner database
Exception - if any error occurs and failOnError is true then generates exception
public static Attribute populateUDTAttribute(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
UserDefinedType udt)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databaseudt - the owner UDT
Exception - if any error occurs and failOnError is true then generates exception
public static void updateUDTSuperType(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
UserDefinedType udt)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databaseudt - the UDT to update
Exception - if any error occurs and failOnError is true then generates exception
public static void updateTableSuperTable(ModelFactory factory,
ResultSet resultSet,
Logger traceLog,
boolean failOnError,
Database database,
Table table)
throws Exception
factory - the model factory to create SP parameterresultSet - the stored procedure parameter result set from DatabaseMetadatatraceLog - the log to write if anyfailOnError - database - the owner databasetable - the table to update
Exception - if any error occurs and failOnError is true then generates exception
public static <T> T getDatabaseMetadataProperty(DatabaseMetaData instance,
String methodName,
Logger traceLog)
T - the return typeinstance - the instance of database metadata implementationmethodName - the full name of a getter method to executetraceLog - the log
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||