KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > impl > sql > compile > MiscellaneousStatementNode


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.compile.MiscellaneousStatementNode
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.compile;
23
24 import org.apache.derby.iapi.services.context.ContextManager;
25
26 import org.apache.derby.iapi.services.sanity.SanityManager;
27
28 import org.apache.derby.iapi.services.compiler.MethodBuilder;
29
30 import org.apache.derby.iapi.sql.ResultSet;
31 import org.apache.derby.iapi.sql.Activation;
32 import org.apache.derby.iapi.sql.execute.ConstantAction;
33 import org.apache.derby.iapi.reference.ClassName;
34
35 import org.apache.derby.iapi.error.StandardException;
36
37 import org.apache.derby.iapi.services.classfile.VMOpcode;
38
39 import org.apache.derby.impl.sql.compile.ActivationClassBuilder;
40
41 /**
42  * A MiscellaneousStatement represents any type of statement that doesn't
43  * fit into the well defined categores:
44  * SET (non-transaction).
45  *
46  * @author Jerry Brenner
47  */

48
49 abstract class MiscellaneousStatementNode extends StatementNode
50 {
51
52     int activationKind()
53     {
54            return StatementNode.NEED_NOTHING_ACTIVATION;
55     }
56
57     /**
58      * Generic generate code for all Misc statements
59      * that need activations.
60      *
61      * @param acb The ActivationClassBuilder for the class being built
62      * @param mb the method for the execute() method to be built
63      *
64      * @exception StandardException Thrown on error
65      */

66
67     public void generate(ActivationClassBuilder acb,
68                                 MethodBuilder mb)
69                             throws StandardException
70     {
71         // The generated java is the expression:
72
// return ResultSetFactory.getMiscResultSet(this )
73

74         acb.pushGetResultSetFactoryExpression(mb);
75
76         acb.pushThisAsActivation(mb); // first arg
77

78         mb.callMethod(VMOpcode.INVOKEINTERFACE, (String JavaDoc) null, "getMiscResultSet",
79                         ClassName.ResultSet, 1);
80     }
81     /**
82      * Returns whether or not this Statement requires a set/clear savepoint
83      * around its execution. The following statement "types" do not require them:
84      * Cursor - unnecessary and won't work in a read only environment
85      * Xact - savepoint will get blown away underneath us during commit/rollback
86      *
87      * @return boolean Whether or not this Statement requires a set/clear savepoint
88      */

89     public boolean needsSavepoint()
90     {
91         return false;
92     }
93 }
94
Popular Tags