1 package com.daffodilwoods.daffodildb.server.sql99.ddl.schemadefinition; 2 3 import com.daffodilwoods.daffodildb.server.serversystem.*; 4 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 5 import com.daffodilwoods.database.resource.*; 6 7 public class tableelementlist implements tablecontentssource { 8 public tableelement[] _OptRepScomma94843605tableelement0; 9 10 private TableDescriptor tableDescriptor; 11 12 public void setTableDescriptor(_Descriptor tableDes) throws DException { 13 tableDescriptor = (TableDescriptor) tableDes; 14 } 15 16 22 23 25 public Object run(Object object) throws DException { 26 checkUnsupprotedGrammer(); 27 checkForColumnDefinitionExistance(); 28 executeTableElements(tableDescriptor, object); 29 return null; 30 } 31 32 private void checkUnsupprotedGrammer() throws DException { 33 } 34 35 38 39 private void checkForColumnDefinitionExistance() throws DException { 40 boolean columnFound = false; 41 for (int i = 0, elementCount = _OptRepScomma94843605tableelement0.length; i < elementCount; i++) { 42 if (!columnFound && _OptRepScomma94843605tableelement0[i] instanceof columndefinition) { 43 columnFound = true; 44 } 45 } 46 if (!columnFound) { 47 throw new DException("DSE956", null); 48 } 49 } 50 51 private void executeTableElements(TableDescriptor tableDescriptor, 52 Object object) throws DException { 53 executeColumnDefinitions(tableDescriptor, object); 54 executeConstraintDefinitions(tableDescriptor, object); 55 } 56 57 private void executeColumnDefinitions(TableDescriptor tableDescriptor, 58 Object object) throws 59 DException { 60 for (int i = 0, elementCount = _OptRepScomma94843605tableelement0.length; i < elementCount; i++) { 61 if (_OptRepScomma94843605tableelement0[i] instanceof columndefinition) { 62 _OptRepScomma94843605tableelement0[i].setTableDescriptor(tableDescriptor); 63 _OptRepScomma94843605tableelement0[i].run(object); 64 } 65 } 66 } 67 68 private void executeConstraintDefinitions(TableDescriptor tableDescriptor, 69 Object object) throws DException { 70 for (int i = 0, elementCount = _OptRepScomma94843605tableelement0.length; i < elementCount; i++) { 71 tableelement tableElement = _OptRepScomma94843605tableelement0[i]; 72 if (tableElement instanceof tableconstraintdefinition) { 73 tableElement.setTableDescriptor(tableDescriptor); 74 if (! ( ( (tableconstraintdefinition) tableElement)._tableconstraint1 instanceof 75 referentialconstraintdefinition)) { 76 tableElement.run(object); 77 } 78 } 79 } 80 } 81 82 public void setReferentialConstraints(Object object) throws DException { 83 for (int i = 0, elementCount = _OptRepScomma94843605tableelement0.length; i < elementCount; i++) { 84 tableelement tableElement = _OptRepScomma94843605tableelement0[i]; 85 if (tableElement instanceof tableconstraintdefinition) { 86 if ( ( (tableconstraintdefinition) tableElement)._tableconstraint1 instanceof 87 referentialconstraintdefinition) { 88 tableElement.run(object); 89 } 90 } else if (tableElement instanceof columndefinition) { 91 ( (columndefinition) tableElement).setReferentialConstraints( ( 92 _ServerSession) object); 93 } 94 } 95 } 96 97 98 public void validateCheckConstraintSemantic(Object object) throws DException { 99 for (int i = 0, elementCount = _OptRepScomma94843605tableelement0.length; i < elementCount; i++) { 100 tableelement tableElement = _OptRepScomma94843605tableelement0[i]; 101 if (tableElement instanceof tableconstraintdefinition) { 102 tableconstraintdefinition temp = (tableconstraintdefinition) tableElement; 103 if (temp._tableconstraint1 instanceof checkconstraintdefinition) { 104 ( (checkconstraintdefinition) temp._tableconstraint1). 105 validateCheckConstraintSemantic( (_ServerSession) object); 106 } 107 } else if (tableElement instanceof columndefinition) { 108 ( (columndefinition) tableElement).validateCheckConstraintSemantic( 109 (_ServerSession) object); 110 } 111 } 112 } 113 114 public Object clone() throws CloneNotSupportedException { 115 return this; 116 } 117 118 public String toString() { 119 StringBuffer sb = new StringBuffer (); 120 sb.append(" "); 121 sb.append(_OptRepScomma94843605tableelement0[0]); 122 for (int i = 1; i < _OptRepScomma94843605tableelement0.length; i++) { 123 sb.append(",").append(_OptRepScomma94843605tableelement0[i]); 124 } 125 return sb.toString(); 126 } 127 } 128 | Popular Tags |