Skip to content

Commit

Permalink
Update supportsTransactions to handle whitespace in error, and proper…
Browse files Browse the repository at this point in the history
…ty state after error (#2227)

* Update supports transactions for 2226

* Changed behaviour from default to true to default to false

* supportsTransactions should be null for non-specific exception
  • Loading branch information
Jeffery-Wasty authored Oct 5, 2023
1 parent 298292b commit b1f7b09
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8100,19 +8100,18 @@ boolean supportsTransactions() throws SQLServerException {
return supportsTransactions;
}

supportsTransactions = true;

try {
this.connectionCommand("SELECT @@TRANCOUNT", "SQLServerConnection.supportsTransactions");
} catch (SQLServerException e) {
if (e.getMessage().equals(SQLServerException.getErrString("R_transactionsNotSupported"))) {
if (e.getMessage().trim().equals(SQLServerException.getErrString("R_transactionsNotSupported"))) {
supportsTransactions = false;
return false;
}
throw e;
}

return supportsTransactions;
supportsTransactions = true;
return true;
}

/**
Expand Down

0 comments on commit b1f7b09

Please sign in to comment.