fgl_native_error( )

 

The fgl_native_error() function returns a CHAR(n) value, which represents the text of the error message of the native RDBMS for the last SQL statement executed.

 

Sample Code: fgl_native_error_function.4gl

 

DATABASE cms

 

MAIN

  DEFINE sql_stmt VARCHAR(255)

  DEFINE driver_error, native_error VARCHAR(255)

  DEFINE native_code INTEGER

 

  LET sql_stmt = "Invalid SQL statement"

 

  WHENEVER ERROR CONTINUE

    PREPARE p1 FROM sql_stmt

    DECLARE c1 CURSOR FOR p1

    OPEN c1

  WHENEVER ERROR STOP

 

  LET driver_error = fgl_driver_error()

  LET native_error = fgl_native_error()

  LET native_code = fgl_native_code()

 

  DISPLAY "Driver error: " AT 5, 5

  DISPLAY driver_error AT 6, 5

  DISPLAY "" AT 7, 5

  DISPLAY "Native error: " AT 8, 5

  DISPLAY native_error AT 9, 5

  DISPLAY "Native error code: ", native_code AT 16,5

 

  CALL fgl_winmessage("Exit","Press any key to close this demo application","info")

END MAIN