1 package com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary; 2 3 import java.util.*; 4 5 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 6 import com.daffodilwoods.daffodildb.server.serversystem.*; 7 import com.daffodilwoods.daffodildb.server.sql99.common.*; 8 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dql.resultset.*; 11 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 12 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 13 import com.daffodilwoods.database.resource.*; 14 15 public class subquery extends AbstractRowValueExpression implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, _Reference, SimpleConstants, TypeConstants { 16 17 public queryexpression _queryexpression0; 18 private int index = -1; 19 int size; 20 String reason; 21 public _ColumnCharacteristics getColumnCharacteristics(Object object) throws DException { 22 return _queryexpression0.getColumnCharacteristics(object); 23 } 24 25 public Object run(Object object) throws com.daffodilwoods.database.resource.DException { 26 return ( (_VariableValues) object).getColumnValues(this); 27 } 28 29 public _Iterator getSelectIterator(_ServerSession session) throws DException { 30 return (_Iterator) ( (SelectExecuter) _queryexpression0.run(session)).executeWithOutValues(); 31 } 32 33 public ParameterInfo[] getParameterInfo() throws DException { 34 ParameterInfo[] pi = _queryexpression0.getParameterInfo(); 35 ParameterInfo p = new ParameterInfo(); 36 p.setSubQuery(true); 37 if (pi != null) { 38 p.setParameterInfoArray(pi); 39 } 40 return new ParameterInfo[] {p}; 41 } 42 43 public int getReferenceType() throws DException { 44 return SUBQUERY; 45 } 46 47 public _Reference[] getUnderlyingReferences() throws DException { 48 return _queryexpression0.getUnderlyingReferences(); 49 } 50 51 public String getColumn() throws DException { 52 throw new DException("DSE16", new Object [] {"getColumn"}); 53 } 54 55 public void setIndex(int index) throws DException { 56 Thread.dumpStack(); 57 this.index = index; 58 } 59 60 public int getIndex() throws DException { 61 if (index == -1) { 62 throw new DException("DSE565", null); 63 } 64 return index; 65 } 66 67 public String getQualifiedColumnName() throws DException { 68 69 throw new java.lang.UnsupportedOperationException ("Method getQualifiedColumnName() not yet implemented."); 70 } 71 72 public int dataType = -1; 73 74 75 public String getTriggerTableAlias() throws DException { 76 throw new java.lang.UnsupportedOperationException ("Method getTriggerTableAlias() not yet implemented."); 77 } 78 79 public int getDatatype() throws DException { 80 throw new UnsupportedOperationException (); 81 } 82 83 public void setDatatype(int type) throws DException { 84 throw new UnsupportedOperationException (); 85 } 86 87 public void setSize(int size0) throws DException { 88 size = size0; 89 } 90 91 public int getSize() throws DException { 92 return size; 93 } 94 95 public AbstractRowValueExpression[] getChilds() { 96 throw new UnsupportedOperationException ("" + getClass()); 97 } 98 99 public boolean checkForSubQuery() throws DException { 100 return true; 101 } 102 103 110 111 public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent) throws DException { 112 113 if(_queryexpression0.getOrderByclause()!=null) 114 throw new DException("DSE8208",null); 115 return _queryexpression0.checkSemantic(parent, true); } 117 118 public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent, boolean checkUserRight) throws DException { 119 120 if(_queryexpression0.getOrderByclause()!=null) 121 throw new DException("DSE8208",null); 122 return _queryexpression0.checkSemantic(parent, checkUserRight); } 124 125 public _Reference[] getReferences(TableDetails[] tableDetails) throws DException { 126 return new _Reference[] {this}; 127 } 128 129 public String toString() { 130 StringBuffer sb = new StringBuffer (); 131 sb.append(" "); 132 sb.append("("); 133 sb.append(" "); 134 sb.append(_queryexpression0); 135 sb.append(" "); 136 sb.append(")"); 137 return sb.toString(); 138 } 139 140 public Object clone() throws CloneNotSupportedException { 141 subquery tempClass = new subquery(); 142 tempClass._queryexpression0 = (queryexpression) _queryexpression0.clone(); 143 tempClass.isCloned=true; 144 return tempClass; 145 } 146 147 public void getColumnsIncluded(ArrayList aList) throws DException { 148 _queryexpression0.getColumnsIncluded(aList); 149 } 150 151 public void getTablesIncluded(ArrayList aList) throws DException { 152 _queryexpression0.getTablesIncluded(aList); 153 } 154 155 public ColumnDetails[] getColumnDetails() throws DException { 156 return new ColumnDetails[0]; 157 } 158 159 public Object [] getParameters(Object object) throws DException { 160 return _queryexpression0.getParameters(object); 161 } 162 163 public int getColumnCount() throws DException { 164 return _queryexpression0.getSelectedColumns().length; 165 } 166 167 public ByteComparison getByteComparison(Object object) throws DException { 168 ColumnDetails[] cd = _queryexpression0.getSelectedColumns(); 169 int length = cd.length; 170 int[] result = new int[length]; 171 boolean byteUsage = true; 172 for (int i = 0; i < length; i++) { 173 result[i] = cd[i].getDatatype(); 174 if (cd[i].getType() != TypeConstants.REFERENCE) { 175 byteUsage = false; 176 } 177 } 178 ByteComparison b = new ByteComparison(byteUsage, result); 179 b.setField(new Object [length]); 180 return b; 181 } 182 183 public ColumnDetails[] getSelectedColumnDetails() throws DException { 184 return _queryexpression0.getSelectedColumns(); 185 } 186 public void setReason(String reason0) throws DException { 187 reason = reason0; 188 } 189 190 public String getReason() throws DException { 191 return reason; 192 } 193 public void releaseResource() throws DException { 194 } 195 196 197 boolean isCloned; 198 public boolean isCloned(){ 199 return isCloned; 200 } 201 public void setCloned(boolean isCloned0){ 202 isCloned=isCloned0; 203 } 204 205 } 206 | Popular Tags |