Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / sql / compile / UntypedNullConstantNode.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/compile/UntypedNullConstantNode.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/compile/UntypedNullConstantNode.java
new file mode 100644 (file)
index 0000000..9f85f0c
--- /dev/null
@@ -0,0 +1,108 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.compile.UntypedNullConstantNode\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package        org.apache.derby.impl.sql.compile;\r
+\r
+import org.apache.derby.iapi.services.compiler.MethodBuilder;\r
+\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import org.apache.derby.iapi.types.DataValueDescriptor;\r
+import org.apache.derby.iapi.types.DataTypeDescriptor;\r
+\r
+import org.apache.derby.impl.sql.compile.ExpressionClassBuilder;\r
+\r
+import java.util.Vector;\r
+/**\r
+ * An UntypedNullConstantNode represents a SQL NULL before it has\r
+ * been bound.  The bind() operation will replace the UntypedNullConstantNodes\r
+ * with typed ConstantNodes.\r
+ */\r
+\r
+public final class UntypedNullConstantNode extends ConstantNode\r
+{\r
+       /**\r
+        * Constructor for an UntypedNullConstantNode.  Untyped constants\r
+        * contain no state (not too surprising).\r
+        */\r
+\r
+       public UntypedNullConstantNode()\r
+       {\r
+               super();\r
+       }\r
+\r
+       /**\r
+        * Return the length\r
+        *\r
+        * @return      The length of the value this node represents\r
+        *\r
+        */\r
+\r
+       //public int    getLength()\r
+       //{\r
+       //      if (SanityManager.DEBUG)\r
+       //      SanityManager.ASSERT(false,\r
+       //        "Unimplemented method - should not be called on UntypedNullConstantNode");\r
+       //      return 0;\r
+       //}\r
+\r
+       /**\r
+        * Should never be called for UntypedNullConstantNode because\r
+        * we shouldn't make it to generate\r
+        *\r
+        * @param acb   The ExpressionClassBuilder for the class being built\r
+        * @param mb    The method the expression will go into\r
+        */\r
+       void generateConstant(ExpressionClassBuilder acb, MethodBuilder mb)\r
+       {\r
+               if (SanityManager.DEBUG)\r
+               {\r
+                       SanityManager.THROWASSERT("generateConstant() not expected to be called for UntypedNullConstantNode because we have implemented our own generateExpression().");\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Translate a Default node into a default value, given a type descriptor.\r
+        *\r
+        * @param typeDescriptor        A description of the required data type.\r
+        *\r
+        */\r
+       public DataValueDescriptor convertDefaultNode(DataTypeDescriptor typeDescriptor)\r
+       throws StandardException\r
+       {\r
+               /*\r
+               ** The default value is null, so set nullability to TRUE\r
+               */\r
+               return typeDescriptor.getNull();\r
+       }\r
+       \r
+       /** @see ValueNode#bindExpression(FromList, SubqueryList, Vector)\r
+        * @see ResultColumnList#bindUntypedNullsToResultColumns\r
+        * This does nothing-- the node is actually bound when\r
+        * bindUntypedNullsToResultColumns is called.\r
+        */\r
+       public ValueNode bindExpression(FromList fromList, SubqueryList subqueryList, Vector aggregateVector)\r
+       {\r
+               return this;\r
+       }\r
+}\r