diff --git a/java/src/main/java/com/genexus/db/DataStoreProvider.java b/java/src/main/java/com/genexus/db/DataStoreProvider.java index 17fbe4b77..73f0e5382 100644 --- a/java/src/main/java/com/genexus/db/DataStoreProvider.java +++ b/java/src/main/java/com/genexus/db/DataStoreProvider.java @@ -274,9 +274,7 @@ private void execute(int cursorIdx, Object[] parms, boolean preExecute) cursor.status = 0; try { - executeSavePointOperation("SAVEPOINT gxselectforupdate", cursor); cursor.postExecute(this, getDataSource()); - executeSavePointOperation("RELEASE SAVEPOINT gxselectforupdate", cursor); } catch (SQLException e) { @@ -346,7 +344,6 @@ private void execute(int cursorIdx, Object[] parms, boolean preExecute) { } } - executeSavePointOperation("ROLLBACK TO SAVEPOINT gxselectforupdate", cursor); } } retryCount = retryCount + 1; @@ -432,23 +429,6 @@ private void setParameters(int cursorIdx, Object[] parms, Cursor cursor, } } - - private void executeSavePointOperation(String operation, Cursor cursor) - { - if (getDataSource().dbms.getId() == GXDBMS.DBMS_POSTGRESQL && GXutil.dbmsVersion( context, remoteHandle, getDataSource().name) > 7 && cursor instanceof ForEachCursor && cursor.isCurrentOf()) - { - try - { - SentenceProvider.executeStatement(this, operation); - } - catch (Exception ex) - { - System.err.println(operation + " error " + ex.getMessage()); - ex.printStackTrace(); - } - } - } - static Object lock = new Object(); public void readNext(int cursorIdx) diff --git a/java/src/main/java/com/genexus/db/DefaultExceptionErrorHandler.java b/java/src/main/java/com/genexus/db/DefaultExceptionErrorHandler.java index 10a200a60..f41024a6b 100644 --- a/java/src/main/java/com/genexus/db/DefaultExceptionErrorHandler.java +++ b/java/src/main/java/com/genexus/db/DefaultExceptionErrorHandler.java @@ -39,6 +39,8 @@ public static void handleSQLError1(IErrorHandler errorHandler, SQLException e, M } if (!context.inErrorHandler) { + if (e.getCause() != null && e.getCause() instanceof SQLException) + e = ((SQLException)e.getCause()); if (errorHandler != null) { context.globals.Gx_err = (short) cursor.status; diff --git a/java/src/main/java/com/genexus/db/driver/GXDBMSpostgresql.java b/java/src/main/java/com/genexus/db/driver/GXDBMSpostgresql.java index 07083a7b7..fad14605e 100644 --- a/java/src/main/java/com/genexus/db/driver/GXDBMSpostgresql.java +++ b/java/src/main/java/com/genexus/db/driver/GXDBMSpostgresql.java @@ -96,9 +96,10 @@ public boolean DuplicateKeyValue(SQLException e) public boolean ObjectLocked(SQLException e) { String sqlstate = e.getSQLState().toLowerCase(); - if (sqlstate.indexOf("55p03")>=0) - return true; - return false; + String sqlstateCause = ""; + if (e.getCause() != null && e.getCause() instanceof SQLException) + sqlstateCause = ((SQLException)e.getCause()).getSQLState().toLowerCase(); + return sqlstate.contains("55p03") || sqlstateCause.contains("55p03"); } public boolean ObjectNotFound(SQLException e)