Skip to content

Allow DB access even where the DB needs BI truncation or is running and your connection is Read Only (RO) #677

Description

@cptaps

Is your feature request related to a problem? Please describe.
When I open an ABL project, the ProBro DB access may not just immediately work. I mostly just want to review the DB schema or occasionally verify the 'kind' of data that might be stored in a particular field. Therefore, I set up my openedge.project file with a -RO connection in the default profile. This allows me to start and stop the DB and the ABL Language server just continues running throughout. The problem is that once you start up the DB, ProBro can no longer connect with a RO connection (unlike the ABL Language Server compilation threads/processes.) Also, the BI might subsequently need truncation, which is another connection warning returned from the CONNECT statement that can be ignored.

Describe the solution you'd like
A more complete solution would be to inform the user that they are connected but with a degredation in capabilities, but a quick win would be to apply a patch like the following:

vscode ➜ /workspaces/ProBro (develop) $ git diff resources/oe/src/oeCore.i
diff --git a/resources/oe/src/oeCore.i b/resources/oe/src/oeCore.i
index af2d308..0170d74 100644
--- a/resources/oe/src/oeCore.i
+++ b/resources/oe/src/oeCore.i
@@ -69,11 +69,21 @@ END FUNCTION.
 
 PROCEDURE LOCAL_CONNECT:
     DEFINE VARIABLE tmpDate AS DATETIME-TZ NO-UNDO.
+    DEFINE VARIABLE i AS INTEGER NO-UNDO.
 
     tmpDate = NOW.
     CONNECT VALUE(inputObject:GetCharacter("connectionString")) NO-ERROR.
     IF ERROR-STATUS:ERROR THEN DO:
-        UNDO, THROW NEW Progress.Lang.AppError(ERROR-STATUS:GET-MESSAGE(1), ERROR-STATUS:GET-NUMBER(1)).
+        DO i = 1 to ERROR-STATUS:NUM-MESSAGES:
+            // Ignore warnings for BI Truncation (1552) and Reads Only access to a Running DB (1531)
+            // https://progress.my.site.com/s/article/P17401
+            // See also _dict.p which informs the user, but still allows the connection
+            IF ERROR-STATUS:GET-NUMBER(i) = 1531 OR ERROR-STATUS:GET-NUMBER(i) = 1552 THEN DO:
+                LOG-MANAGER:WRITE-MESSAGE(SUBSTITUTE("CONNECT WARNING (&1): &2",ERROR-STATUS:GET-NUMBER(i),ERROR-STATUS:GET-MESSAGE(i))).
+                NEXT.
+            END.
+            UNDO, THROW NEW Progress.Lang.AppError(ERROR-STATUS:GET-MESSAGE(i), ERROR-STATUS:GET-NUMBER(i)).
+        END.
     END.
 
     jsonObject:Set("debug", CREATE_DEBUG(tmpDate, "Connect")).

Describe alternatives you've considered
N/A

Additional context
N/A

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions