Programming Guide



sm_tm_dbi_checker

Tests for common database errors during transaction manager processing

#include <tmusubs.h>
int sm_tm_dbi_checker(int event);

event
TM_TEST_ERROR to check for database errors, TM_TEST_ONE_ROW to check that one row was affected by the processing, or TM_TEST_SOME_ROWS to check that one or more rows was affected by the processing.

Returns

Description

sm_tm_dbi_checker tests the Panther database variables @dmretcode and @dmengerrcode for any errors in database processing. If it finds an error, it logs it and sets error messages.

If no database errors are encountered but event is TM_TEST_ONE_ROW, sm_tm_dbi_checker returns the error status TM_FAILURE if @dmrowcount is not 1.

Similarly, if event is TM_TEST_SOME_ROWS, sm_tm_dbi_checker returns the error status TM_FAILURE if @dmrowcount is 0.

Example

/* The following example taken from the standard 
transaction model for JDB shows the processing for
these events. */
	case TM_TEST_ERROR:
case TM_TEST_ONE_ROW:
case TM_TEST_SOME_ROWS:
retcode = sm_tm_dbi_checker(event);
break;