Kbase P99530: Is it possible to suppress error messages from ODBC DB2 driver?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/01/2005 |
|
Status: Unverified
GOAL:
Is it possible to suppress error messages from ODBC DB2 driver?
GOAL:
Data Direct DB2 Wire Protocol driver
FACT(s) (Environment):
IBM AS/400 (RISC)
ODBC DataServer
OpenEdge 10.x
FIX:
Any error messages generated by a Connect for ODBC driver will not be displayed unless the application first specifically requests them by calling SQLError or SQLGetDiagRec. The DataServer layer checks for such messages after every API call to ensure nothing went wrong. If an error is return, it informs the application about this fact. Any errors from DB2/400, driver, or DataServer are passed to the application and can be handled in a standard fashion. When NO-ERROR clause is not used the messages appear on the screen.
Here's the sample situation when you add a record to a child table (TABLE) without an existing record in the parent table. The constraint definition forbids this and appropriate error is generated. You can capture and handle the error(s) in the following way:
DO TRANSACTION:
CREATE COLLECTION.TABLE NO-ERROR.
ASSIGN
COLLECTION.TABLE.FIELD1 = 'VALUE1'
COLLECTION.TABLE.FIELD2 = 'VALUE2'
NO-ERROR.
VALIDATE COLLECTION.TABLE NO-ERROR.
IF ERROR-STATUS:ERROR THEN DO:
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
MESSAGE "got the following error(s) during validate()" SKIP
ERROR-STATUS:GET-NUMBER(i) SKIP
ERROR-STATUS:GET-MESSAGE(i) SKIP
VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
UNDO.
END.
END.