Error handling of database lookup

Database Lookup returns an error as long as there is an error during the query.

In all cases, meaningful error messages are logged in the engine log file. Meaningful, human, and machine readable errors are returned to the user for action by UPoC scripts or other means.

The table control values that are defined in the .tbl file are used when the query is run and no result set is returned.

In the database lookup TABLE action, you can select Skip to ignore the error, or Error to move the message into the error database.

Error handling of the hcidblookup Tcl extension

If there is an error during running hcidblookup, then the error information is appended to the Tcl result. You can use catch {dblookup table value} errMsg to get the error information ($errMsg) of hcidblookup.

If there are no errors during running hcidblookup but no data is queried, then the default value is set to the Tcl result.

Variables for database lookup

Two variables are available in database lookup. These can be used after running the database lookup table action to indicate the detail error information.

  • @tbl_errno

    This integer variable is for the TABLE action to indicate the query result. Before running the TABLE action, @tbl_errno is initialized to 0. After running the action:

    • @tbl_errno is set to -1 if there is an error during query.
    • @tbl_errno is set to 1 if there are multiple rows returned.

You can use @tbl_errno in subsequent actions to do error handling. The error number and error information of database lookup are also dumped in the engine error log.

  • If no data is returned or there are errors returned from the TABLE Action, then the output field is set to the default value.
  • If multiple rows are returned from the TABLE Action, then @tbl_errno is set to 1. A Tcl list of the field value for all rows is set to the output field, and a warning is written to the engine log.
  • @ tbl_errdetail

    This variable indicates the detail error information.

Tcl variables

The Tcl variables $xlateTblErrNo and $xlateTblErrDetail are added to the Database Lookup TABLE post proc fragment. You can use these directly in the Tcl UPoC.

  • $xlateTblErrNo has the same meaning as @tbl_errno.
  • $xlateTblErrDetail has the same meaning as @tbl_errdetail.