|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.epicentric.common.DBManagerUtils
Static methods for database interaction, including creating and closing JDBC connections.
| Field Summary | |
static char |
DEFAULT_SEPARATOR
Deprecated. |
| Constructor Summary | |
DBManagerUtils()
Deprecated. |
|
| Method Summary | |
static void |
addBLOBColumn(Connection c,
String tableName,
String columnName)
Deprecated. Add a BLOB column to a table (encapsulates portability issues with BLOB type names). |
static void |
addColumn(Connection c,
String tableName,
com.epicentric.sql.schema.Column column)
Deprecated. Adds a column to a table (really encapsulates potential portability issues with SQL 'alter table'). |
static void |
addColumn(Connection c,
String tableName,
String columnName,
String columnType)
Deprecated. As of version 3.5. Will be removed in 8.0 or later. Use addColumn(Connection, String, Column) instead. |
static PreparedStatement |
buildInsertStatement(Connection dbConnection,
String tableName,
Vector colDescriptors)
Deprecated. Given connection, table name and a vector of DBColumnDescriptors, create an insert statement. |
static PreparedStatement |
buildUpdateStatement(Connection dbConnection,
String tableName,
Vector updateDescriptors,
String whereClause,
Vector whereClauseDescriptors)
Deprecated. Given connection, table name and a vector of DBColumnDescriptors, create an update statement. |
static boolean |
checkForWarning(SQLWarning warn)
Deprecated. If given SQLWarning is nonull, display the warning message(s), descending through the chained messages, if there are any. |
static void |
closeDBConnection(Connection conn)
Deprecated. Close the Connection, trapping all exceptions. |
static void |
closeResultSet(ResultSet rs)
Deprecated. Close the ResultSet, trapping all errors. |
static void |
closeStatement(Statement statement)
Deprecated. Close the Statement, trapping all exceptions. |
static boolean |
columnExists(Connection c,
String tableName,
String columnName)
Deprecated. Check if a table column exists |
static void |
dumpSQLExceptions(SQLException ex)
Deprecated. Log all SQL exceptions chained within the given SQL exception. |
static String |
getDateFunction(Connection c)
Deprecated. Return function or other SQL fragment to get current date and time. |
static Connection |
getDBConnection(Properties props)
Deprecated. Return a database connection, given the key under which to find JDBC setup info in the vignette properties file. |
static Connection |
getDBConnection(String databaseKey)
Deprecated. Return a database connection, given the key under which to find JDBC setup info in the vignette properties file. |
static String |
getDBStringFromIntArray(int[] intArray)
Deprecated. Works with getIntArrayFromDBString() to provide a simple encoding and decoding of integer values that can be stored in a single String field. |
static String |
getDBStringFromIntArray(int[] intArray,
char separator)
Deprecated. Integer-to-string encoding, with your choice of separator character. |
static int[] |
getIntArrayFromDBString(String dbString)
Deprecated. Works with getDBStringFromIntArray() to provide a simple encoding and decoding of integer values that can be stored in a single String field. |
static int[] |
getIntArrayFromDBString(String dbString,
char separator)
Deprecated. Like getIntArrayFromDBString(String), but lets you specify the separator character. |
static boolean |
isIntegrityConstraintViolation(String sqlState)
Deprecated. Return a boolean indicating whether a given "SQL state" string (taken from SQLException.getSQLState()) indicates an integrity constraint violation such as a uniqueness constraint violation. |
static boolean |
isNoDataFoundException(String sqlState)
Deprecated. Return a boolean indicating whether a given "SQL state" string (taken from SQLException.getSQLState()) indicates a No Data Found condition. |
static boolean |
isTransactionDeadlock(String sqlState)
Deprecated. Return a boolean indicating whether a given "SQL state" string (taken from SQLException.getSQLState()) indicates an transaction deadlock resolution. |
static String |
makeUniqueID()
Deprecated. As of version 4.0. Will be removed in 8.0 or later. Will not be replaced. Use com.epicentric.uid.UniqueIDFactory instead. |
static void |
setupStore(String store)
Deprecated. Given the name of a database, get its .setup file and create the db using the SQL statements contained within the file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static char DEFAULT_SEPARATOR
| Constructor Detail |
public DBManagerUtils()
| Method Detail |
public static Connection getDBConnection(String databaseKey)
throws SQLException
databaseName - e.g. "portalbeans", "persistentscheduler"
public static Connection getDBConnection(Properties props)
throws SQLException
databaseName - e.g. "portalbeans", "persistentscheduler"public static void closeDBConnection(Connection conn)
public static void closeResultSet(ResultSet rs)
public static void closeStatement(Statement statement)
public static boolean checkForWarning(SQLWarning warn)
throws SQLException
public static PreparedStatement buildInsertStatement(Connection dbConnection,
String tableName,
Vector colDescriptors)
throws SQLException
connection - to databasetableName - dbDescriptors - is vector of DBColumnDescriptors that will be included in the INSERT.
public static PreparedStatement buildUpdateStatement(Connection dbConnection,
String tableName,
Vector updateDescriptors,
String whereClause,
Vector whereClauseDescriptors)
throws SQLException
connection - to databasetableName - updateDescriptors - is vector of DBColumnDescriptors
that will be included in the UPDATEwhereClause - The entire prepared whereClause, including
replacement symbols. The replacement symbols will be
filled with whereClauseDescriptor values.
e.g. "where myColumn1 = ? and myColumn2 < ?"whereClauseDescriptors - is vector of DBDescriptors
that will be included in the WHERE clause. Note this
could be null even if there is a whereClause, if the
whereClause itself does not require any replacements.public static String getDBStringFromIntArray(int[] intArray)
intArray - #getIntArrayFromDBString()
public static String getDBStringFromIntArray(int[] intArray,
char separator)
intArray - separator. - #getIntArrayFromDBString()
public static int[] getIntArrayFromDBString(String dbString)
throws NumberFormatException
String - from database#getIntArrayFromDBString()
public static int[] getIntArrayFromDBString(String dbString,
char separator)
throws NumberFormatException
String - from databaseDBManagerUtils.getIntArrayFromDBString(String)public static void dumpSQLExceptions(SQLException ex)
public static void setupStore(String store)
public static boolean columnExists(Connection c,
String tableName,
String columnName)
throws SQLException
public static void addColumn(Connection c,
String tableName,
com.epicentric.sql.schema.Column column)
throws SQLException
public static void addColumn(Connection c,
String tableName,
String columnName,
String columnType)
throws SQLException
DBManagerUtils.addColumn(Connection, String, Column)
public static void addBLOBColumn(Connection c,
String tableName,
String columnName)
throws SQLException
public static String makeUniqueID()
UniqueIDFactory
public static String getDateFunction(Connection c)
throws SQLException
public static boolean isIntegrityConstraintViolation(String sqlState)
sqlState - the string returned by SQLException.getSQLState()
when a SQLException occurs.public static boolean isTransactionDeadlock(String sqlState)
sqlState - the string returned by SQLException.getSQLState()
when a SQLException occurs.public static boolean isNoDataFoundException(String sqlState)
sqlState - the string returned by SQLException.getSQLState()
when a SQLException occurs.
|
02/28/2005 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||