1 package com.daffodilwoods.daffodildb.server.sql99.token; 2 3 import java.util.*; 4 5 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 6 import com.daffodilwoods.daffodildb.server.serversystem.*; 7 import com.daffodilwoods.daffodildb.server.sql99.common.*; 8 import com.daffodilwoods.daffodildb.server.sql99.dcl.sqlconnectionstatement.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dcl.sqlcontrolstatement.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dcl.sqltransactionstatement.*; 11 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 12 import com.daffodilwoods.daffodildb.server.sql99.ddl.schemadefinition.*; 13 import com.daffodilwoods.daffodildb.server.sql99.ddl.schemamanipulation.*; 14 import com.daffodilwoods.daffodildb.server.sql99.dml.*; 15 import com.daffodilwoods.daffodildb.server.sql99.dml.declarecursor.*; 16 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; 17 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.orderbyclause.*; 18 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryspecification.*; 19 import com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression.fromclause.*; 20 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 21 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.predicates.*; 22 import com.daffodilwoods.daffodildb.server.sql99.expression.datetimevalueexpression.*; 23 import com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary.*; 24 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 25 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 26 import com.daffodilwoods.daffodildb.utils.*; 27 import com.daffodilwoods.daffodildb.utils.field.*; 28 import com.daffodilwoods.database.resource.*; 29 import com.daffodilwoods.database.utility.*; 30 import com.daffodilwoods.daffodildb.server.sql99.common.ColumnDetails; 31 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryspecification.selectsublist; 32 import in.co.daffodil.db.jdbc.DatabaseProperties; 33 import com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary.result; 34 35 43 public class SRESERVEDWORD1206543922 extends AbstractBooleanValueExpression implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, 44 _TOKEN, setquantifier, action, grantor, routinetype, datatypedomainname, 45 referentialaction, characterstringtype, predefinedtype, 46 defaultoption, matchtype, columnconstraint, triggeractiontime, 47 triggerevent, actiontyperule, parametermode, grantee,javadatatype, 48 dropbehavior, ascdesctype, fetchorientation, cursorscrollability, 49 generalvaluespecification, constraintnamelist, connectiontarget, connectionobject, 50 disconnectobject, orderingspecification, constrainttype, 51 datatype, outerjointype, jointype, quantifier, 52 uniquespecification, contextuallytypedvaluespecification,parameterstyle, 53 result, truthvalue, cursorstatus, fetchtype,languagename,deterministiccharacteristic, 54 sequenceorder, cycleinsequence, sequenceindicators, booleanliteral, timezonespecifier,selectsublist,returnvalue ,SQLargument { 55 public String _SRESERVEDWORD12065439220; 56 private Object returnObject = null; 57 public long getEstimatedRows(long noOfRows) throws DException { 58 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.FALSE)) { 59 return 0; 60 } 61 return noOfRows; 62 } 63 64 public _QualifiedBVE getQualifiedBVE(TableDetails[] tableDetails) throws DException { 65 throw new DException("DSE565", new Object [] {"getQualifiedBVE()"}); 66 } 67 68 transient DataTypeDescriptor dataTypeDescriptor; 69 70 public void setDescriptor(_Descriptor dataTypeDescriptor) throws DException { 71 this.dataTypeDescriptor = (DataTypeDescriptor) dataTypeDescriptor; 72 } 73 74 public Object run(Object object) throws DException { 75 if(returnObject != null) 76 return returnObject; 77 if (dataTypeDescriptor != null) { 78 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.INTEGER)) { 79 dataTypeDescriptor.data_Type = SqlKeywords.INTEGER; 80 setIntTypeProperties(); 81 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.INT)) { 82 dataTypeDescriptor.data_Type = SqlKeywords.INT; 83 setIntTypeProperties(); 84 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SMALLINT)) { 85 dataTypeDescriptor.data_Type = SqlKeywords.SMALLINT; 86 dataTypeDescriptor.numeric_precision = new Integer (5); 87 setDefaultScaleAndRadix(); 88 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.LONG) || _SRESERVEDWORD12065439220.equalsIgnoreCase("LONGINT")) { 89 dataTypeDescriptor.data_Type = SqlKeywords.LONG; 90 setLongTypeProperties(); 91 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.BIGINT)) { 92 dataTypeDescriptor.data_Type = SqlKeywords.BIGINT; 93 setLongTypeProperties(); 94 } 95 96 else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.REAL)) { 97 dataTypeDescriptor.data_Type = SqlKeywords.REAL; 98 dataTypeDescriptor.numeric_precision = new Integer (7); 99 dataTypeDescriptor.numeric_precision_radix = new Integer (2); 100 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.BYTE)) { 101 dataTypeDescriptor.data_Type = SqlKeywords.BYTE; 102 setByteTypeProperties(); 103 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.TINYINT)) { 104 dataTypeDescriptor.data_Type = SqlKeywords.TINYINT; 105 setByteTypeProperties(); 106 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.VARCHAR)) { 107 dataTypeDescriptor.data_Type = SqlKeywords.VARCHAR; 108 dataTypeDescriptor.character_maximum_length = new Integer (1); 109 dataTypeDescriptor.character_octet_length = new Integer (0); 110 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.VARBINARY)) { 111 dataTypeDescriptor.data_Type = SqlKeywords.VARBINARY; 112 dataTypeDescriptor.character_maximum_length = new Integer (1); 113 dataTypeDescriptor.character_octet_length = new Integer (0); 114 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.DATE)) { 115 dataTypeDescriptor.data_Type = SqlKeywords.DATE; 116 dataTypeDescriptor.datatime_precision = new Integer (10); 117 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.BOOLEAN)) { 118 dataTypeDescriptor.data_Type = SqlKeywords.BOOLEAN; 119 } else { 120 throw new DException("DSE565", new Object [] {_SRESERVEDWORD12065439220}); 121 } 122 } 123 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_USER) || 124 _SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.USER)) { 125 try { 126 return new FieldStringLiteral( ( (_VariableValues) object). 127 getServerSession().getCurrentUser(), 128 Datatype.CHARACTER); 129 } 130 catch (ClassCastException ex) { 131 throw ex; 132 } 133 } 134 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_PATH)) { 135 return new FieldStringLiteral(ServerSystem.DAFFODILDB_HOME, Datatype.CHARACTER); 136 } 137 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_ROLE)) { 138 return new FieldStringLiteral( ( (_VariableValues) object).getServerSession().getCurrentRole(), Datatype.CHARACTER); 139 } 140 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SESSION_USER)) { 141 throw new DException("DSE16", new Object [] {_SRESERVEDWORD12065439220}); 142 } 143 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATABASE)) { 144 return new FieldStringLiteral( ( (_VariableValues) object).getServerSession().getDatabase(), Datatype.CHARACTER); 145 } 146 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATE)) { 147 return new FieldDateLiteral( ( (_VariableValues) object).getServerSession().getDate()); 148 } 149 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIMESTAMP)) { 150 return new FieldTimeStampLiteral( ( (_VariableValues) object).getServerSession().getTimeStamp()); 151 } 152 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIME)) { 153 return new FieldTimeLiteral( ( (_VariableValues) object).getServerSession().getTime()); 154 } 155 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.VALUE)) { 156 return ( (_VariableValues) object).getColumnValues(columnDetails); 157 } 158 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.TRUE)) { 159 return returnObject = IntegerPool.Integer0; 160 } 161 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.FALSE)) { 162 return returnObject = IntegerPool.Integer1; 163 } 164 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.UNKNOWN)) { 165 return returnObject = IntegerPool.Integer_1; 166 } 167 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.NULL)) { 168 if (columnDetails != null) 169 return FieldUtility.getField(columnDetails[0].getDatatype(), FieldUtility.NULLBUFFERRANGE); 170 else 171 return new FieldLiteral(FieldUtility.NULLBUFFERRANGE, -1); } 173 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.DEFAULT)){ 174 return returnObject = new FieldLiteral(FieldUtility.NULLBUFFERRANGE, Datatypes.DEFAULT_DATATYPE); 175 176 } 177 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SYSDATE)) { 178 return new FieldTimeStampLiteral( ( (_VariableValues) object).getServerSession().getTimeStamp()); 179 } 180 181 182 return _SRESERVEDWORD12065439220; 183 } 184 185 private void setLongTypeProperties() throws DException { 186 dataTypeDescriptor.numeric_precision = new Integer (19); 187 setDefaultScaleAndRadix(); 188 } 189 190 private void setByteTypeProperties() throws DException { 191 dataTypeDescriptor.numeric_precision = new Integer (3); 192 setDefaultScaleAndRadix(); 193 } 194 195 private void setIntTypeProperties() throws DException { 196 dataTypeDescriptor.numeric_precision = new Integer (10); 197 setDefaultScaleAndRadix(); 198 } 199 200 private void setDefaultScaleAndRadix() throws DException { 201 dataTypeDescriptor.numeric_scal = new Integer (0); 202 dataTypeDescriptor.numeric_precision_radix = new Integer (dataTypeDescriptor.implicit_numeric_precision_radix); 203 } 204 205 public int getType() { 206 return RESERVEDWORD; 207 } 208 209 public ArrayList get_columns() throws DException { 210 return null; 211 } 212 213 private ColumnDetails[] columnDetails; 214 public ColumnDetails[] getColumnDetails() throws DException { 215 if (columnDetails != null) { 216 return columnDetails; 217 } 218 ColumnDetails columnDetail = new ColumnDetails(); 219 columnDetail.setType(TypeConstants.CONSTANT); 220 columnDetail.setDatatype(Datatypes.CHARACTER); 221 columnDetail.setColumnName(new String [] {toString().trim()}); 222 223 columnDetail.setObject(this); 224 225 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.TRUE)) { 226 columnDetail.setColumnName(new String [] {SqlKeywords.TRUE}); 227 columnDetail.setDatatype(Datatypes.BOOLEAN); 228 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.FALSE)) { 229 columnDetail.setColumnName(new String [] {SqlKeywords.FALSE}); 230 columnDetail.setDatatype(Datatypes.BOOLEAN); 231 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.UNKNOWN)) { 232 columnDetail.setColumnName(new String [] {SqlKeywords.UNKNOWN}); 233 columnDetail.setDatatype(Datatypes.BOOLEAN); 234 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_USER)) { 235 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_USER}); 236 columnDetail.setDatatype(Datatypes.VARCHAR); 237 columnDetail.setSize(DatabaseProperties.maxUserNameLength); 238 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATABASE)) { 239 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_DATABASE}); 240 columnDetail.setDatatype(Datatypes.VARCHAR); 241 columnDetail.setSize(DatabaseProperties.maxColumnNameLength); 242 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_ROLE)) { 243 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_ROLE}); 244 columnDetail.setDatatype(Datatypes.VARCHAR); 245 columnDetail.setSize(DatabaseProperties.maxColumnNameLength); 246 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATE)) { 247 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_DATE}); 248 columnDetail.setDatatype(Datatypes.DATE); 249 columnDetail.setSize(Datatypes.DATESIZE); 250 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIMESTAMP)) { 251 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_TIMESTAMP}); 252 columnDetail.setDatatype(Datatypes.TIMESTAMP); 253 columnDetail.setSize(Datatypes.TIMESTAMPSIZE); 254 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIME)) { 255 columnDetail.setColumnName(new String [] {SqlKeywords.CURRENT_TIME}); 256 columnDetail.setDatatype(Datatypes.TIME); 257 columnDetail.setSize(Datatypes.TIMESIZE); 258 } else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.NULL)) { 259 columnDetail.setColumnName(new String [] {SqlKeywords.NULL}); 260 columnDetail.setDatatype(Datatypes.VARCHAR); 261 columnDetail.setSize(DatabaseProperties.maxCharLiteralLength); 262 }else if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SYSDATE)) { 263 columnDetail.setColumnName(new String [] {SqlKeywords.SYSDATE}); 264 columnDetail.setDatatype(Datatypes.TIMESTAMP); 265 columnDetail.setSize(Datatypes.TIMESTAMPSIZE); 266 } 267 columnDetails = new ColumnDetails[] {columnDetail}; 268 return columnDetails; 269 } 270 271 public Object [] getParameters(Object object) throws DException { 272 return null; 273 } 274 275 public ParameterInfo[] getParameterInfo() throws DException { 276 ParameterInfo pi = new ParameterInfo(); 277 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.TRUE)) { 278 pi.setDataType(Datatypes.BOOLEAN); 279 } 280 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.FALSE)) { 281 pi.setDataType(Datatypes.BOOLEAN); 282 } 283 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.UNKNOWN)) { 284 pi.setDataType(Datatypes.BOOLEAN); 285 } 286 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATE)) { 287 pi.setDataType(Datatypes.DATE); 288 } 289 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIME)) { 290 pi.setDataType(Datatypes.TIME); 291 } 292 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_TIMESTAMP)) { 293 pi.setDataType(Datatypes.TIMESTAMP); 294 } 295 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_DATABASE)) { 296 pi.setDataType(Datatypes.CHARACTER); 297 } 298 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.CURRENT_USER)) { 299 pi.setDataType(Datatypes.CHARACTER); 300 } 301 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SYSDATE)) { 302 pi.setDataType(Datatypes.TIMESTAMP); 303 } 304 305 pi.setName("Expr"); 306 return new ParameterInfo[] {pi}; 307 308 } 309 310 public ColumnDetails[] getChildColumnDetails() throws DException { 311 return null; 312 } 313 314 public void getColumnsIncluded(ArrayList aList) throws DException { 315 } 316 317 public void getTablesIncluded(ArrayList aList) throws DException { 318 } 319 320 public int getCardinality() throws DException { 321 return 1; 322 } 323 324 public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession object) throws DException { 325 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.SESSION_USER)) { 326 throw new DException("DSE16", new Object [] {_SRESERVEDWORD12065439220}); 327 } 328 return null; 329 } 330 331 public AbstractRowValueExpression[] getChilds() { 332 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {}; 333 return childs; 334 } 335 336 public String toString() { 337 StringBuffer sb = new StringBuffer (); 338 sb.append(" "); 339 sb.append(_SRESERVEDWORD12065439220); 340 return sb.toString().trim(); 341 } 342 343 public Object clone() throws CloneNotSupportedException { 344 return this; 345 } 346 347 public _BVEPlan getExecutionPlan() throws DException { 348 return new BVEAllTablePlan(null, null, BVEPlanMerger.getBooleanFactor(this)); 349 } 350 351 public double getCost(long rowCount, boolean index) throws DException { 352 if (_SRESERVEDWORD12065439220.equalsIgnoreCase(SqlKeywords.FALSE)) { 353 return 0; 354 } 355 return rowCount; 356 } 357 358 public int getConditionType() throws DException { 359 return ExecutionPlanConstants.PREDICATE; 360 } 361 362 public boolean isNullPredicate() throws DException { 363 return false; 364 } 365 366 public void setColumnPredicates(_AllColumnPredicates allColumnPredicates) throws DException { 367 allColumnPredicates.addToNonIndex(BVEPlanMerger.getBooleanFactor(this)); 368 } 369 370 public ByteComparison getByteComparison(Object object) throws DException { 371 getColumnDetails(); 372 return new ByteComparison(false, new int[] {columnDetails[0].getDatatype()}); 373 } 374 375 public ColumnDetails[] getDerivedColumnDetails() throws DException { 376 getColumnDetails(); 377 ColumnDetails columnDetail = getClonedCD(columnDetails[0]); 378 columnDetail.setObject(this); 379 return new ColumnDetails[]{columnDetail}; 380 381 } 382 383 private ColumnDetails getClonedCD(ColumnDetails cd) throws DException { 384 try { 385 return (ColumnDetails) cd.clone(); 386 } 387 catch (CloneNotSupportedException ex) { 388 throw new DException("DSE0", new Object [] {"Clone Not Supported"}); 389 } 390 } 391 392 } 393 429 | Popular Tags |