KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > execute > SetTransactionIsolationConstantAction


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.execute.SetTransactionIsolationConstantAction
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (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 /**
38  * This class describes actions that are ALWAYS performed for a
39  * SET TRANSACTION ISOLATION Statement at Execution time.
40  *
41  * @author Jerry Brenner.
42  */

43
44 class SetTransactionIsolationConstantAction extends GenericConstantAction
45 {
46
47     private final int isolationLevel;
48
49     // CONSTRUCTORS
50

51     /**
52      * Make the ConstantAction for a SET TRANSACTION ISOLATION statement.
53      *
54      * @param isolationLevel The new isolation level
55      */

56     SetTransactionIsolationConstantAction(
57                                 int isolationLevel)
58     {
59         this.isolationLevel = isolationLevel;
60     }
61
62     ///////////////////////////////////////////////
63
//
64
// OBJECT SHADOWS
65
//
66
///////////////////////////////////////////////
67

68     public String JavaDoc toString()
69     {
70         // Do not put this under SanityManager.DEBUG - it is needed for
71
// error reporting.
72
return "SET TRANSACTION ISOLATION LEVEL = " + isolationLevel;
73     }
74
75     // INTERFACE METHODS
76

77     /**
78      * This is the guts of the Execution-time logic for SET TRANSACTION ISOLATION.
79      *
80      * @see ConstantAction#executeConstantAction
81      *
82      * @exception StandardException Thrown on failure
83      */

84     public void executeConstantAction( Activation activation )
85                         throws StandardException
86     {
87         activation.getLanguageConnectionContext().setIsolationLevel(isolationLevel);
88     }
89 }
90
Popular Tags