fgl_native_code()

When working with non-Informix RDBMS, Querix 4GL tries to provide the closest Informix error code on an error condition.

The fgl_native_code() function returns an INTEGER value, which represents the actual error code from  the native RDBMS for the last SQL statement executed, as opposed to the Informix equivalent.

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

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.