01: /*
02:
03: Derby - Class org.apache.derby.impl.sql.compile.MiscellaneousStatementNode
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.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: int activationKind() {
52: return StatementNode.NEED_NOTHING_ACTIVATION;
53: }
54:
55: /**
56: * Generic generate code for all Misc statements
57: * that need activations.
58: *
59: * @param acb The ActivationClassBuilder for the class being built
60: * @param mb the method for the execute() method to be built
61: *
62: * @exception StandardException Thrown on error
63: */
64:
65: public void generate(ActivationClassBuilder acb, MethodBuilder mb)
66: throws StandardException {
67: // The generated java is the expression:
68: // return ResultSetFactory.getMiscResultSet(this )
69:
70: acb.pushGetResultSetFactoryExpression(mb);
71:
72: acb.pushThisAsActivation(mb); // first arg
73:
74: mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null,
75: "getMiscResultSet", ClassName.ResultSet, 1);
76: }
77:
78: /**
79: * Returns whether or not this Statement requires a set/clear savepoint
80: * around its execution. The following statement "types" do not require them:
81: * Cursor - unnecessary and won't work in a read only environment
82: * Xact - savepoint will get blown away underneath us during commit/rollback
83: *
84: * @return boolean Whether or not this Statement requires a set/clear savepoint
85: */
86: public boolean needsSavepoint() {
87: return false;
88: }
89: }
|