01: /*
02:
03: Derby - Class org.apache.derby.impl.sql.execute.SetTransactionIsolationConstantAction
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (the "License"); you may not use this file except in compliance with
10: the License. You may obtain a copy of the License at
11:
12: http://www.apache.org/licenses/LICENSE-2.0
13:
14: Unless required by applicable law or agreed to in writing, software
15: distributed under the License is distributed on an "AS IS" BASIS,
16: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: See the License for the specific language governing permissions and
18: limitations under the License.
19:
20: */
21:
22: package org.apache.derby.impl.sql.execute;
23:
24: import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
25:
26: import org.apache.derby.iapi.sql.execute.ConstantAction;
27:
28: import org.apache.derby.iapi.reference.SQLState;
29:
30: import org.apache.derby.iapi.sql.Activation;
31:
32: import org.apache.derby.iapi.error.StandardException;
33:
34: import org.apache.derby.iapi.store.access.TransactionController;
35:
36: /**
37: * This class describes actions that are ALWAYS performed for a
38: * SET TRANSACTION ISOLATION Statement at Execution time.
39: *
40: * @author Jerry Brenner.
41: */
42:
43: class SetTransactionIsolationConstantAction extends
44: GenericConstantAction {
45:
46: private final int isolationLevel;
47:
48: // CONSTRUCTORS
49:
50: /**
51: * Make the ConstantAction for a SET TRANSACTION ISOLATION statement.
52: *
53: * @param isolationLevel The new isolation level
54: */
55: SetTransactionIsolationConstantAction(int isolationLevel) {
56: this .isolationLevel = isolationLevel;
57: }
58:
59: ///////////////////////////////////////////////
60: //
61: // OBJECT SHADOWS
62: //
63: ///////////////////////////////////////////////
64:
65: public String toString() {
66: // Do not put this under SanityManager.DEBUG - it is needed for
67: // error reporting.
68: return "SET TRANSACTION ISOLATION LEVEL = " + isolationLevel;
69: }
70:
71: // INTERFACE METHODS
72:
73: /**
74: * This is the guts of the Execution-time logic for SET TRANSACTION ISOLATION.
75: *
76: * @see ConstantAction#executeConstantAction
77: *
78: * @exception StandardException Thrown on failure
79: */
80: public void executeConstantAction(Activation activation)
81: throws StandardException {
82: activation.getLanguageConnectionContext().setIsolationLevel(
83: isolationLevel);
84: }
85: }
|