}
}
- protected void check() {
+ protected void check() throws MDatabaseConnectionFailureException {
try {
this.getConnection().prepareStatement("/* ping */ SELECT 1", PreparedStatement.RETURN_GENERATED_KEYS);
}
catch (SQLException exception) {
- try {
- this.initialize();
- }
- catch (MDatabaseConnectionFailureException exception2) { // should not happen
- }
+ this.initialize();
}
}
this.setTransactionStatus(MDatabaseConnection.TransactionStatus.SUCCESSFUL);
this.logStatement("### BEGIN TRANSACTION ###");
}
+ catch (MDatabaseConnectionFailureException exception) {
+ throw new MSqlTransactionException("Could not start transaction.", exception);
+ }
catch (SQLException exception) {
throw new MSqlTransactionException("Could not start transaction.", exception);
}
results = new MSqlStatementResults(preparedStatement, localTypesMode);
this.logStatement(preparedStatement.toString());
}
+ catch (MDatabaseConnectionFailureException exception) {
+ if (MDatabaseConnection.TransactionStatus.SUCCESSFUL == this.getTransactionStatus()) {
+ this.setTransactionStatus(MDatabaseConnection.TransactionStatus.FAILED);
+ }
+ throw new MSqlStatementException(String.format("Could not execute prepared statement: %s.", preparedStatement), exception);
+ }
catch (SQLException exception) {
if (MDatabaseConnection.TransactionStatus.SUCCESSFUL == this.getTransactionStatus()) {
this.setTransactionStatus(MDatabaseConnection.TransactionStatus.FAILED);