1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.sql.compile.CompilerContext; 25 import org.apache.derby.iapi.sql.conn.Authorizer; 26 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 27 import org.apache.derby.iapi.sql.execute.ConstantAction; 28 29 import org.apache.derby.iapi.error.StandardException; 30 31 import org.apache.derby.iapi.services.sanity.SanityManager; 32 import org.apache.derby.iapi.reference.SQLState; 33 34 40 41 public class DropSchemaNode extends DDLStatementNode 42 { 43 private int dropBehavior; 44 private String schemaName; 45 46 53 public void init(Object schemaName, Object dropBehavior) 54 throws StandardException 55 { 56 initAndCheck(null); 57 this.schemaName = (String ) schemaName; 58 this.dropBehavior = ((Integer ) dropBehavior).intValue(); 59 } 60 61 public QueryTreeNode bind() throws StandardException 62 { 63 64 LanguageConnectionContext lcc = getLanguageConnectionContext(); 65 66 70 if (getDataDictionary().isSystemSchemaName(schemaName)) 71 { 72 throw(StandardException.newException( 73 SQLState.LANG_CANNOT_DROP_SYSTEM_SCHEMAS, this.schemaName)); 74 } 75 76 81 if (isPrivilegeCollectionRequired()) 82 { 83 getCompilerContext().addRequiredSchemaPriv(schemaName, 84 lcc.getAuthorizationId(), 85 Authorizer.DROP_SCHEMA_PRIV); 86 } 87 88 return this; 89 } 90 91 97 98 public String toString() 99 { 100 if (SanityManager.DEBUG) 101 { 102 return super.toString() + 103 "dropBehavior: " + "\n" + dropBehavior + "\n"; 104 } 105 else 106 { 107 return ""; 108 } 109 } 110 111 public String statementToString() 112 { 113 return "DROP SCHEMA"; 114 } 115 116 118 119 124 public ConstantAction makeConstantAction() throws StandardException 125 { 126 return getGenericConstantActionFactory().getDropSchemaConstantAction(schemaName); 127 } 128 } 129 | Popular Tags |