Class Utils
java.lang.Object
uk.ac.manchester.spinnaker.alloc.db.Utils
Miscellaneous database-related utility operations.
- Author:
- Donal Fellows
-
Method Summary
Modifier 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
-
trimSQL
Exclude comments and compress whitespace from the SQL of a statement.- Parameters:
sql- The text of the SQL to trim.- Returns:
- The trimmed SQL.
-
trimSQL
Exclude 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.
-
isBusy
Utility 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.
-
isBusy
Utility 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.
-
mapException
Convert an SQL-related exception into an unchecked exception.- Parameters:
exception- The exception to convert.sql- Optional SQL that caused the problem. May benull.- Returns:
- The converted exception; this is not thrown by this method!
-