KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.impl.sql.compile.NOPStatementNode
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.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 {
38     public String JavaDoc statementToString()
39     {
40         return "NO-OP";
41     }
42
43     /**
44      * Bind this NOP statement. This throws an exception, because NOP
45      * statements by definition stop after parsing.
46      *
47      * @return The bound query tree
48      *
49      * @exception StandardException Always thrown to stop after parsing
50      */

51     public QueryTreeNode bind() throws StandardException
52     {
53         /*
54         ** Prevent this statement from getting to execution by throwing
55         ** an exception during the bind phase. This way, we don't
56         ** have to generate a class.
57         */

58
59         throw StandardException.newException(SQLState.LANG_PARSE_ONLY);
60     }
61
62     int activationKind()
63     {
64            return StatementNode.NEED_NOTHING_ACTIVATION;
65     }
66 }
67
Popular Tags