Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / MyDerby-10.3 / java / engine / org / apache / derby / impl / sql / compile / CreateSchemaNode.java
diff --git a/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/compile/CreateSchemaNode.java b/JMCR-Stable/real-world application/MyDerby-10.3/java/engine/org/apache/derby/impl/sql/compile/CreateSchemaNode.java
new file mode 100644 (file)
index 0000000..327fcb4
--- /dev/null
@@ -0,0 +1,114 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.compile.CreateSchemaNode\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.error.StandardException;\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+import org.apache.derby.iapi.sql.compile.CompilerContext;\r
+import org.apache.derby.iapi.sql.conn.Authorizer;\r
+import org.apache.derby.iapi.sql.execute.ConstantAction;\r
+\r
+/**\r
+ * A CreateSchemaNode is the root of a QueryTree that \r
+ * represents a CREATE SCHEMA statement.\r
+ *\r
+ */\r
+\r
+public class CreateSchemaNode extends DDLStatementNode\r
+{\r
+       private String  name;\r
+       private String  aid;\r
+       \r
+       /**\r
+        * Initializer for a CreateSchemaNode\r
+        *\r
+        * @param schemaName    The name of the new schema\r
+        * @param aid                   The authorization id\r
+        *\r
+        * @exception StandardException         Thrown on error\r
+        */\r
+       public void init(\r
+                       Object  schemaName,\r
+                       Object  aid)\r
+               throws StandardException\r
+       {\r
+               /*\r
+               ** DDLStatementNode expects tables, null out\r
+               ** objectName explicitly to clarify that we\r
+               ** can't hang with schema.object specifiers.\r
+               */\r
+               initAndCheck(null);     \r
+       \r
+               this.name = (String) schemaName;\r
+               this.aid = (String) aid;\r
+       }\r
+\r
+       /**\r
+        * Convert this object to a String.  See comments in QueryTreeNode.java\r
+        * for how this should be done for tree printing.\r
+        *\r
+        * @return      This object as a String\r
+        */\r
+\r
+       public String toString()\r
+       {\r
+               if (SanityManager.DEBUG)\r
+               {\r
+                       return super.toString() +\r
+                               "schemaName: " + "\n" + name + "\n" +\r
+                               "authorizationId: " + "\n" + aid + "\n";\r
+               }\r
+               else\r
+               {\r
+                       return "";\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Bind this createSchemaNode. Main work is to create a StatementPermission\r
+        * object to require CREATE_SCHEMA_PRIV at execution time.\r
+        */\r
+       public void bindStatement() throws StandardException\r
+       {\r
+               CompilerContext cc = getCompilerContext();\r
+               if (isPrivilegeCollectionRequired())\r
+                       cc.addRequiredSchemaPriv(name, aid, Authorizer.CREATE_SCHEMA_PRIV);\r
+\r
+       }\r
+       \r
+       public String statementToString()\r
+       {\r
+               return "CREATE SCHEMA";\r
+       }\r
+\r
+       // We inherit the generate() method from DDLStatementNode.\r
+\r
+       /**\r
+        * Create the Constant information that will drive the guts of Execution.\r
+        *\r
+        * @exception StandardException         Thrown on failure\r
+        */\r
+       public ConstantAction   makeConstantAction()\r
+       {\r
+               return  getGenericConstantActionFactory().getCreateSchemaConstantAction(name, aid);\r
+       }\r
+}\r