01: /*
02:
03: Derby - Class org.apache.derby.impl.sql.compile.NOPStatementNode
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.error.StandardException;
27: import org.apache.derby.iapi.reference.SQLState;
28:
29: /**
30: * A NOPStatement node is for statements that don't do anything. At the
31: * time of this writing, the only statements that use it are
32: * SET DB2J_DEBUG ON and SET DB2J_DEBUG OFF. Both of these are
33: * executed in the parser, so the statements don't do anything at execution
34: */
35:
36: public class NOPStatementNode extends StatementNode {
37: public String statementToString() {
38: return "NO-OP";
39: }
40:
41: /**
42: * Bind this NOP statement. This throws an exception, because NOP
43: * statements by definition stop after parsing.
44: *
45: * @return The bound query tree
46: *
47: * @exception StandardException Always thrown to stop after parsing
48: */
49: public QueryTreeNode bind() throws StandardException {
50: /*
51: ** Prevent this statement from getting to execution by throwing
52: ** an exception during the bind phase. This way, we don't
53: ** have to generate a class.
54: */
55:
56: throw StandardException.newException(SQLState.LANG_PARSE_ONLY);
57: }
58:
59: int activationKind() {
60: return StatementNode.NEED_NOTHING_ACTIVATION;
61: }
62: }
|