Programming Guide


Chapter 9 . Transaction Model Events

The transaction manager accesses two layers of transaction models: the common model and a database-specific model. The common transaction model contains the functionality common to all of the database engines; the database-specific model contains processing necessary for a specific database engine.

The source code for the database-specific transaction models is provided in the distribution and can be modified to make global changes in transaction manager functionality. The common model should not be modified; however, the source code is available for reference.

For more information, refer to Application Development GuideChapter 35, "Generating Transaction Manager Events," for how the transaction manager uses the transaction model and to Chapter 32, "Writing Transaction Event Functions," for an explanation of the return codes.


Common Transaction Model

Table 9-1lists the events generated for each transaction manager command in the common model. The events are listed in the table in the order in which they are processed. Error and diagnostic events are indicated for the events which might generate them, although many of the error events shown are unlikely to be encountered. The error checking events are done after the events that give rise to them, and before any other event processing.

The transaction manager command documentation contains a description of the processing for each event; refer to Chapter 8, "Transaction Manager Commands."

Reading the Event Table

For compactness, whenever it is possible, the lower level events are shown on the same line as the higher level events that give rise to them. Thus, the entry for the FETCH command compresses the information about six events into the following two lines:

Command Request Slice Slice Error Error

FETCH

TM_FETCH

.

.

E

F

.

.

TM_SEL_CHECK

TM_SEL_CHECK

E

F

For a description of the error events, refer to "Error and Diagnostic Events."

Table 9-1 Transaction manager request events

Command Request with Corresponding Error Events Slices with Corresponding Error Events

CHANGE

CLEAR

PRE_CLOSE

CLOSE

QUERY

DISCARD

POST_CLOSE

POST_SAVE1

PRE_CLEAR

CLEAR

POST_CLEAR

CLOSE

PRE_CLOSE

CLOSE

QUERY

DISCARD

POST_CLOSE

POST_SAVE1

CONTINUE

FETCH - E /F

SEL_CHECK - E/F

PRE_SELECT

SELECT

GET_SEL_CURSOR - F

SEL_GEN - F

CLEAR

POST_SELECT

PRE_VIEW

VIEW

GET_SEL_CURSOR - F

SEL_GEN - F

CLEAR

POST_VIEW

CONTINUE_BOTTOM

CONTINUE_BOTTOM - E,F/F

SEL_CHECK

GIVE_UP_SEL_CURSOR

PRE_SELECT

SELECT

GET_SEL_CURSOR - F

SEL_GEN - F

CLEAR

POST_SELECT

PRE_VIEW

VIEW

GET_SEL_CURSOR - F

SEL_GEN - F

CLEAR

POST_VIEW

CONTINUE_DOWN

CONTINUE_DOWN - E,F/F

refer to CONTINUE_BOTTOM for the remainder of the requests and slices

CONTINUE_TOP

CONTINUE_TOP - E,F/F

refer to CONTINUE_BOTTOM for the remainder of the requests and slices

CONTINUE_UP

CONTINUE_UP - E,F/F

refer to CONTINUE_BOTTOM for the remainder of the requests and slices

COPY

PRE_CLOSE

CLOSE

QUERY

DISCARD

POST_CLOSE

POST_SAVE1

PRE_COPY

COPY

POST_COPY

COPY_FOR_UPDATE

PRE_CLOSE

CLOSE

QUERY

DISCARD

POST_CLOSE

POST_SAVE1

PRE_COPY_FOR_UPDATE

COPY_FOR_UPDATE

POST_COPY_FOR_UPDATE

COPY_FOR_VIEW

PRE_CLOSE

CLOSE

QUERY

POST_CLOSE

POST_SAVE1

PRE_COPY_FOR_VIEW

COPY_FOR_VIEW

POST_COPY_FOR_VIEW

FETCH

FETCH - E/F

SEL_CHECK - E/F

FINISH

FINISH - E/F

GIVE_UP_SAVE - E/F

GIVE_UP_SEL_CURSOR - E/F

FORCE_CLOSE

PRE_CLOSE

DISCARD

POST_CLOSE

POST_SAVE1

NEW

PRE_CLOSE

CLOSE

QUERY

DISCARD

POST_CLOSE

POST_SAVE1

PRE_NEW

NEW

POST_NEW

REFRESH

RELEASE

PRE_RELEASE

RELEASE

GIVE_UP_SEL_CURSOR - E/F

POST_RELEASE

SAVE

PRE_SAVE

SAVE

DELETE

GET_SAVE_CURSOR - F

UPDATE

GET_SAVE_CURSOR - F

INSERT

GET_SAVE_CURSOR - F

Note: TM_POST_SAVE1

is processed differently for SAVE

than for other commands.

POST_SAVE

POST_SAVE1 - E,F/F

SELECT

PRE_SELECT

SELECT

GET_SEL_CURSOR - F

PREPARE_CONTINUE - E/F

CLEAR

POST_SELECT

START

START

VALIDATE_LINK (internally generated command)

PRE_ VAL_LINK

VAL_LINK

GET_SAVE_CURSOR - F

VAL_GEN - F

POST_VAL_LINK

VIEW

PRE_ VIEW

VIEW

GET_SEL_CURSOR - F

PREPARE_CONTINUE - E/F

CLEAR

POST_SELECT

WALK_DELETE

WALK_DELETE

WALK_INSERT

WALK_INSERT

WALK_SELECT

WALK_SELECT

WALK_UPDATE

WALK_UPDATE

E = TM_TEST_ERROR, O = TM_TEST_ONE_ROW, F = TM_NOTE_FAILURE;

*All request and slice events have TM_ prefix.

**Slice events generated based on server view property specifications.

Error and Diagnostic Events

The transaction error and diagnostic events are generated as a result of return values for other events. The most common error and diagnostic events are shown in the Error columns in Table 63. They are: TM_TEST_ERROR, TM_TEST_ONE_ROW and TM_NOTE_FAILURE.

The slice event TM_SEL_BUILD_PERFORM in all the CONTINUE commands has two events (E and F) in the first Error column, because TM_SEL_BUILD_PERFORM can return TM_CHECK, in addition to TM_FAILURE and TM_OK. In this table, the second F is associated with the E, not with the first F. It is the TM_TEST_ERROR event from TM_SEL_CHECK that can give rise to a further TM_NOTE_FAILURE event.


Database-Specific Transaction Models

Panther transaction models perform specialized processing for their respective databases. Table 9-2 lists the supported databases, the corresponding model name, and the type of non-trivial processing performed by each model.

Table 9-2 Databases and transaction model processing

Database Model INITIAL mode handling BEGIN command processing Specialized processing

DB2

tmdb21.c

Informix

tminf1.c

x

x

Special subroutine.

JDB

tmjdb1.c

Check for duplicates.

SQL Server

tmmss1.c

x

x

Cursor management, etc.

ODBC

tmodb1.c

x

Oracle

tmora1.c

Name and save rollback special tp processing.

Sybase

tmsyb1.c

x

x

Cursor management, etc.

Panther support of databases is subject to change. Panther continually updates database-specific transaction models in order to be consistent with DBMS systems.

INITIAL Mode Handling

For TM_SAVE_SET_MODE, the model sets TM_VALUE to TM_INITIAL_MODE. This means that when a COMMIT has been done in the course of a SAVE command, the model suggests that the mode be set to INITIAL. (Such a suggestion of a mode change can be ignored, particularly in a web application context.)

BEGIN Command Processing

For TM_SAVE_BEGIN, the transaction model does a BEGIN command.

Special Processing

The following models perform specialized processing: