Class Utils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.db.Utils
Miscellaneous database-related utility operations.
- Author:
- Donal Fellows
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanisBusy(SQLException exception) Utility for testing whether an exception was thrown because the database was busy.static booleanisBusy(DataAccessException exception) Utility for testing whether an exception was thrown because the database was busy.static DataAccessExceptionmapException(SQLException exception, String sql) Convert an SQL-related exception into an unchecked exception.static StringExclude comments and compress whitespace from the SQL of a statement.static StringExclude comments and compress whitespace from the SQL of a statement.
- 
Method Details- 
trimSQLExclude comments and compress whitespace from the SQL of a statement.- Parameters:
- sql- The text of the SQL to trim.
- Returns:
- The trimmed SQL.
 
- 
trimSQLExclude comments and compress whitespace from the SQL of a statement.- Parameters:
- sql- The text of the SQL to trim.
- length- The point to insert an ellipsis if required.
- Returns:
- The trimmed SQL.
 
- 
isBusyUtility for testing whether an exception was thrown because the database was busy.- Parameters:
- exception- The outer wrapping exception.
- Returns:
- Whether it was caused by the database being busy.
 
- 
isBusyUtility for testing whether an exception was thrown because the database was busy.- Parameters:
- exception- The exception to test.
- Returns:
- Whether it was caused by the database being busy.
 
- 
mapExceptionConvert an SQL-related exception into an unchecked exception.- Parameters:
- exception- The exception to convert.
- sql- Optional SQL that caused the problem. May be- null.
- Returns:
- The converted exception; this is not thrown by this method!
 
 
-