@@ -59,53 +59,53 @@ For example, consider the following sequence of user commands:
59
59
In the main processing loop, this results in the following function call
60
60
sequence:
61
61
62
- / StartTransactionCommand;
63
- / StartTransaction;
64
- 1) < ProcessUtility; << BEGIN
65
- \ BeginTransactionBlock;
66
- \ CommitTransactionCommand;
67
-
68
- / StartTransactionCommand;
69
- 2) / ProcessQuery; << SELECT ...
70
- \ CommitTransactionCommand;
71
- \ CommandCounterIncrement;
72
-
73
- / StartTransactionCommand;
74
- 3) / ProcessQuery; << INSERT ...
75
- \ CommitTransactionCommand;
76
- \ CommandCounterIncrement;
77
-
78
- / StartTransactionCommand;
79
- / ProcessUtility; << COMMIT
80
- 4) < EndTransactionBlock;
81
- \ CommitTransactionCommand;
82
- \ CommitTransaction;
62
+ / StartTransactionCommand;
63
+ / StartTransaction;
64
+ 1) < ProcessUtility; << BEGIN
65
+ \ BeginTransactionBlock;
66
+ \ CommitTransactionCommand;
67
+
68
+ / StartTransactionCommand;
69
+ 2) / ProcessQuery; << SELECT ...
70
+ \ CommitTransactionCommand;
71
+ \ CommandCounterIncrement;
72
+
73
+ / StartTransactionCommand;
74
+ 3) / ProcessQuery; << INSERT ...
75
+ \ CommitTransactionCommand;
76
+ \ CommandCounterIncrement;
77
+
78
+ / StartTransactionCommand;
79
+ / ProcessUtility; << COMMIT
80
+ 4) < EndTransactionBlock;
81
+ \ CommitTransactionCommand;
82
+ \ CommitTransaction;
83
83
84
84
The point of this example is to demonstrate the need for
85
85
StartTransactionCommand and CommitTransactionCommand to be state smart -- they
86
86
should call CommandCounterIncrement between the calls to BeginTransactionBlock
87
87
and EndTransactionBlock and outside these calls they need to do normal start,
88
88
commit or abort processing.
89
89
90
- Furthermore, suppose the "SELECT * FROM foo" caused an abort condition. In
90
+ Furthermore, suppose the "SELECT * FROM foo" caused an abort condition. In
91
91
this case AbortCurrentTransaction is called, and the transaction is put in
92
92
aborted state. In this state, any user input is ignored except for
93
93
transaction-termination statements, or ROLLBACK TO <savepoint> commands.
94
94
95
95
Transaction aborts can occur in two ways:
96
96
97
- 1) system dies from some internal cause (syntax error, etc)
98
- 2) user types ROLLBACK
97
+ 1) system dies from some internal cause (syntax error, etc)
98
+ 2) user types ROLLBACK
99
99
100
100
The reason we have to distinguish them is illustrated by the following two
101
101
situations:
102
102
103
- case 1 case 2
104
- ------ ------
105
- 1) user types BEGIN 1) user types BEGIN
106
- 2) user does something 2) user does something
107
- 3) user does not like what 3) system aborts for some reason
108
- she sees and types ABORT (syntax error, etc)
103
+ case 1 case 2
104
+ ------ ------
105
+ 1) user types BEGIN 1) user types BEGIN
106
+ 2) user does something 2) user does something
107
+ 3) user does not like what 3) system aborts for some reason
108
+ she sees and types ABORT (syntax error, etc)
109
109
110
110
In case 1, we want to abort the transaction and return to the default state.
111
111
In case 2, there may be more commands coming our way which are part of the
0 commit comments