1 package com.daffodilwoods.daffodildb.server.sql99.ddl.schemamanipulation; 2 3 import com.daffodilwoods.daffodildb.server.serversystem.*; 4 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 5 import com.daffodilwoods.daffodildb.server.sql99.ddl.schemadefinition.*; 6 import com.daffodilwoods.daffodildb.server.sql99.ddl.utility.*; 7 import com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression.fromclause.*; 8 import com.daffodilwoods.daffodildb.server.sql99.token.*; 9 import com.daffodilwoods.database.resource.*; 10 11 public class dropindexstatement implements SQLschemamanipulationstatement { 12 13 public tablename _tablename0; 14 public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439221; 15 public indexname _indexname2; 16 public SNONRESERVEDWORD136444255 _SNONRESERVEDWORD1364442553; 17 public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439224; 18 19 public Object run(Object object) throws DException { 20 _ServerSession currentSession = (_ServerSession) object; 21 IndexDescriptor indexDescriptor = new IndexDescriptor(); 22 indexDescriptor.indexname = (String ) _indexname2.run(object); 23 setTableName(currentSession, indexDescriptor); 24 String schemaOwner = GeneralUtility.getSchemaOwner(indexDescriptor. 25 table_catalog, indexDescriptor.table_schema, currentSession); 26 GeneralUtility.validateUserRights(schemaOwner, currentSession); 27 dropIndex(indexDescriptor, currentSession); 28 29 refreshDataDictionary(currentSession, indexDescriptor); 30 return null; 31 } 32 33 private void refreshDataDictionary(_ServerSession currentSession, 34 IndexDescriptor indexDescriptor) throws DException { 35 currentSession.getDataDictionary() 36 .getIndexCharacteristics(indexDescriptor.getQualifiedTable()).refresh(); 37 } 38 39 private void setTableName(_ServerSession serverSession, 40 IndexDescriptor indexDescriptor) throws DException { 41 indexDescriptor.table_catalog = _tablename0.getCatalogName(); 42 indexDescriptor.table_schema = _tablename0.getSchemaName(); 43 indexDescriptor.table_name = _tablename0.getTableName(); 44 if (indexDescriptor.table_schema == null) { 45 indexDescriptor.table_schema = serverSession.getCurrentSchema(); 46 } 47 if (indexDescriptor.table_catalog == null) { 48 indexDescriptor.table_catalog = serverSession.getCurrentCatalog(); 49 } 50 try { 51 indexDescriptor.load(serverSession); 52 } catch (DException ex) { 53 throw new DException("DSE7057", new Object [] {indexDescriptor.indexname, 54 indexDescriptor.getQualifiedTable().toString()}); 55 } 56 } 57 58 65 public void dropIndex(IndexDescriptor indexDescriptor, _ServerSession currentSession) throws 66 DException { 67 currentSession.dropIndex(indexDescriptor.getQualifiedTable(), 68 indexDescriptor.indexname); 69 indexDescriptor.delete(currentSession); 70 } 71 72 public Object clone() throws CloneNotSupportedException { 73 return this; 74 } 75 76 public String toString() { 77 StringBuffer sb = new StringBuffer (); 78 sb.append(" "); 79 sb.append(_SRESERVEDWORD12065439224); 80 sb.append(" "); 81 sb.append(_SNONRESERVEDWORD1364442553); 82 sb.append(" "); 83 sb.append(_indexname2); 84 sb.append(" "); 85 sb.append(_SRESERVEDWORD12065439221); 86 sb.append(" "); 87 sb.append(_tablename0); 88 return sb.toString(); 89 } 90 91 } 92 | Popular Tags |