Skip to content

Commit

Permalink
0006050: Sybase ASE result set has already been closed during trigger
Browse files Browse the repository at this point in the history
exists check
  • Loading branch information
erilong committed Oct 25, 2023
1 parent d5adb18 commit e138cc1
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ public Boolean execute(Connection con) throws SQLException {
ResultSet rs = null;
try {
rs = stmt.executeQuery();
if (rs.next()) {
return rs.getInt(1) > 0;
}
} catch (Exception ex) {
if (catalogName != null) {
log.debug(
Expand All @@ -234,6 +237,9 @@ public Boolean execute(Connection con) throws SQLException {
log.debug("TRY AGAIN Exceute: select count(*) from {}.dbo.sysobjects where type = 'TR' AND name ='{}'", catalogName,
triggerName);
rs = stmt2.executeQuery();
if (rs.next()) {
return rs.getInt(1) > 0;
}
} catch (Exception ex2) {
log.error(String.format(
"Failed again with catalog... select count(*) from %s.dbo.sysobjects where type = 'TR' AND name = '%s'",
Expand All @@ -248,10 +254,6 @@ public Boolean execute(Connection con) throws SQLException {
ex);
}
}
if (rs.next()) {
int count = rs.getInt(1);
return count > 0;
}
} finally {
if (catalogName != null) {
con.setCatalog(previousCatalog);
Expand Down

0 comments on commit e138cc1

Please sign in to comment.