1 package com.daffodilwoods.daffodildb.server.sql99.token; 2 3 import java.math.*; 4 import java.util.*; 5 6 import com.daffodilwoods.daffodildb.server.sql99.common.*; 7 import com.daffodilwoods.daffodildb.server.sql99.dcl.sqlcontrolstatement.*; 8 import com.daffodilwoods.daffodildb.server.sql99.expression.*; 9 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; 10 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*; 11 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 12 import com.daffodilwoods.daffodildb.utils.byteconverter.*; 13 import com.daffodilwoods.daffodildb.utils.field.*; 14 import com.daffodilwoods.database.resource.*; 15 import com.daffodilwoods.daffodildb.utils.FieldUtility; 16 17 public class unsignedinteger extends AbstractValueExpression implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, largeobjectlength, exactnumericliteral, Datatypes, assignmentsource { 18 public digit[] _unsignedinteger0; 19 ColumnDetails cd; 20 21 byte[] returningBytes = null; 22 23 private BigDecimal identifier; 24 private FieldBase fieldBase; 25 26 public Object run(Object object) throws com.daffodilwoods.database.resource.DException { 27 if (fieldBase == null) { 28 String unsignedInteger = ""; 29 for (int i = 0; i < _unsignedinteger0.length; i++) { 30 String aa = (String ) _unsignedinteger0[i].run(object); 31 unsignedInteger += aa.trim(); 32 } 33 fieldBase = new FieldLiteral(unsignedInteger, -1); 34 } 35 return fieldBase; 36 37 } 38 39 public ColumnDetails[] getColumnDetails() throws DException { 40 if (columnDetails == null) { 41 ColumnDetails columnD = new ColumnDetails(); 42 columnD.setType(CONSTANT); 43 String name = ""; 44 for (int i = 0; i < _unsignedinteger0.length; i++) { 45 String aa = (String ) _unsignedinteger0[i].run(null); 46 name += aa.trim(); 47 } 48 columnD.setColumnName(new String [] {name}); 49 columnD.setObject(this); 50 51 cd = columnD; 52 columnDetails = new ColumnDetails[] {columnD}; 53 } 54 return columnDetails; 55 } 56 57 public Object [] getParameters(Object object) throws DException { 58 return null; 59 } 60 61 public int getType() { 62 return _TOKEN.OTHERS; 63 } 64 65 private byte[] getAppropriateBytes() throws DException { 66 int datatype = cd.getDatatype(); 67 switch (datatype) { 68 case BOOLEAN: 69 return CCzufDpowfsufs.getBytes(new Boolean (identifier.intValue() == 1)); 70 case INT: 71 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 72 case TINYINT: 73 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 74 case INTEGER: 75 return CCzufDpowfsufs.getBytes(new Integer (identifier.intValue())); 76 case LONG: 77 return CCzufDpowfsufs.getBytes(new Long (identifier.longValue())); 78 case SHORT: 79 return CCzufDpowfsufs.getBytes(new Short (identifier.shortValue())); 80 case SMALLINT: 81 return CCzufDpowfsufs.getBytes(new Short (identifier.shortValue())); 82 case BYTE: 83 return new byte[] {identifier.byteValue()}; 84 case FLOAT: 85 return CCzufDpowfsufs.getBytes(new Float (identifier.floatValue())); 86 case DOUBLE: 87 return CCzufDpowfsufs.getBytes(new Double (identifier.doubleValue())); 88 case BIGDECIMAL: 89 case NUMERIC: 90 case DEC: 91 case DECIMAL: 92 return CCzufDpowfsufs.getBytes(identifier); 93 default: 94 throw new DException("DSE4113", new Object [] {StaticClass.getDataTypeName(datatype)}); 95 } 96 } 97 98 public int getCardinality() throws DException { 99 return 1; 100 } 101 102 public AbstractRowValueExpression[] getChilds() { 103 AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] {}; 104 return childs; 105 106 } 107 108 public String toString() { 109 StringBuffer sb = new StringBuffer (); 110 sb.append(" "); 111 for (int i = 0; i < _unsignedinteger0.length; i++) { 112 sb.append(_unsignedinteger0[i]); 113 } 114 return sb.toString(); 115 } 116 117 public Object clone() throws CloneNotSupportedException { 118 unsignedinteger tempClass = new unsignedinteger(); 119 digit[] temp_unsignedinteger0 = new digit[_unsignedinteger0.length]; 120 for (int i = 0; i < _unsignedinteger0.length; i++) { 121 temp_unsignedinteger0[i] = (digit) _unsignedinteger0[i].clone(); 122 } 123 tempClass._unsignedinteger0 = temp_unsignedinteger0; 124 return tempClass; 125 } 126 127 public void getColumnsIncluded(ArrayList aList) throws DException { 128 } 129 130 public void getTablesIncluded(ArrayList aList) throws DException { 131 } 132 133 public ParameterInfo[] getParameterInfo() throws DException { 134 ParameterInfo parameterInfo = new ParameterInfo(); 135 parameterInfo.setDataType(cd.getDatatype()); 136 return new ParameterInfo[] {parameterInfo}; 137 } 138 139 public ByteComparison getByteComparison(Object object) throws DException { 140 return new ByteComparison(true, new int[] {cd.getDatatype()}); 141 } 142 143 public void releaseResource() throws DException { 144 } 145 } 146 | Popular Tags |