Long transactions  Troubleshooting

Chapter 5: Managing Transactions

Recommended actions for transaction management

The following table shows recommended actions with the different combinations of the Allocate, StopCondition, and TransactionMode configuration properties.

Table 5-1: State, event, action table for transaction management

Configuration property states and conditions

Event

Action

TransactionMode = short Allocate = request StopCondition = error or warning

If StopCondition is encountered

Roll back transaction at StopCondition. Do not continue in request. End the connection.

If end of request with no StopCondition

Commit transaction and end the connection.

If begin transaction is encountered in request

Commit transaction. Switch to temporary long transaction mode and turn on begin transaction.

If commit or rollback is encountered

Issue the commit or rollback.

If cursor declare or dynamic prepare is encountered

Commit transaction. Switch to long transaction mode.

TransactionMode = short Allocate = request StopCondition = none

If error or warning is encountered

Do not roll back. Continue in request. Keep the connection until end of request.

If end of request

Commit transaction and end the connection.

If begin transaction is encountered in request

Commit transaction. Switch to temporary long transaction mode and turn on begin transaction.

If commit or rollback is encountered

Issue the commit or rollback.

If cursor declare or dynamic prepare is encountered

Commit transaction. Switch to long transaction mode.

TransactionMode = short Allocate = connect StopCondition = error or warning

If StopCondition is encountered

Roll back transaction at StopCondition. Do not continue in request. Keep the connection.

If end of request with no StopCondition

Commit transaction and keep the connection.

If begin transaction is encountered in request

Commit transaction. Switch to temporary long transaction mode and turn on begin transaction.

If commit or rollback is encountered

Issue the commit or rollback.

If cursor declare or dynamic prepare is encountered

Commit transaction. Switch to long transaction mode.

TransactionMode = short Allocate = connect StopCondition = none

If error or warning is encountered

Do not roll back. Continue in request and keep the connection.

If end of request with no StopCondition

Commit transaction and keep the connection.

If begin transaction is encountered in request

Commit transaction. Switch to temporary long transaction mode and turn on begin transaction.

If commit or rollback is encountered

Issue the commit or rollback.

If cursor declare or dynamic prepare is encountered

Commit transaction. Switch to long transaction mode.

TransactionMode = long or temporary long Allocate = request or connect StopCondition = error or warning

If StopCondition is encountered

Do not roll back transaction at StopCondition. Do not continue in request. Keep the connection.

If end of request with no StopCondition

Keep the connection.

If end of request with commit or rollback

End the connection.

If begin transaction is encountered in request

If not in begin transaction block, set begin transaction. If in begin transaction block, then ignore. Issue message.

If commit or rollback is encountered

Issue the commit or rollback. If in begin transaction block, end begin transaction.

If cursor declare or dynamic prepare is encountered

Execute statement.

Same, plus cursor and dynamic statements all freed and in temporary long mode

If commit or rollback is encountered

Issue the commit or rollback. End begin transaction. Revert to previous transaction mode.

Same, plus cursor and dynamic statements active and in temporary long mode

If Free of a cursor or dynamic means that all cursors and dynamics are now freed

Execute free. If not in begin transaction block, revert to previous transaction mode.

TransactionMode = long or temporary long Allocate = request or connect StopCondition = none

If StopCondition is encountered

Do not roll back transaction at StopCondition. Continue in request and keep the connection.

If end of request with no StopCondition

Keep the connection.

If end of request with commit or rollback

End the connection.

If begin transaction is encountered in request

If not in begin transaction block, set begin transaction. If in begin transaction block, then ignore. Issue message.

TransactionMode = long or temporary long Allocate = request or connect StopCondition = none

If commit or rollback is encountered

Issue the commit or rollback. If in begin transaction block, end begin transaction.

If cursor declare or dynamic prepare is encountered

Execute statement.

Same, plus cursor and dynamic statements all freed and in temporary long mode

If commit or rollback is encountered

Issue the commit or rollback. End begin transaction. Revert to previous transaction mode.

Same, plus cursor and dynamic statements active and in temporary long mode

If Free of a cursor or dynamic, all cursors and dynamics are now freed

Execute free. If not in begin transaction block, revert to previous transaction mode.





Copyright © 2005. Sybase Inc. All rights reserved. Troubleshooting

View this book as PDF