| 1 package com.daffodilwoods.daffodildb.server.datasystem.utility; 2 3 import com.daffodilwoods.daffodildb.server.sql99.dql.execution._TableInfo; 4 5 6 import com.daffodilwoods.daffodildb.server.datasystem.interfaces._TableCharacteristics; 7 import com.daffodilwoods.database.resource.DException; 8 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*; 9 import com.daffodilwoods.daffodildb.server.datasystem.persistentsystem.*; 10 import com.daffodilwoods.daffodildb.utils.field.FieldBase; 11 import com.daffodilwoods.daffodildb.utils.FieldUtility; 12 import com.daffodilwoods.daffodildb.utils.BufferRange; 13 public class Record implements _Record { 14 15 _TableCharacteristics tableCharacteristics; 16 Object [] object; 17 18 public Record(_TableCharacteristics tableCharacteristics0,Object [] object0) { 19 tableCharacteristics = tableCharacteristics0; 20 object = object0; 21 } 22 23 public void setObject(Object [] row) { 24 object = row; 25 } 26 27 public void update(String column,Object value ) throws DException{ 28 int index = tableCharacteristics.getIndexForColumnName(column); 29 if(index == -1) 30 throw DatabaseConstants.COLUMN_NOTFOUND_EXCEPTION; 31 object[index] = value; 32 } 33 34 public void update(int index,Object value ) throws DException{ 35 object[index] = value; 36 } 37 38 public void update ( int[] columns , Object [] values ) throws DException{ 39 if(columns == null) 40 return ; 41 for(int i = 0 ; i < columns.length ; i++){ 42 object[columns[i]] = values[i]; 43 44 } 45 } 46 47 public Object getObject(int columnIndex)throws DException{ 48 return object[columnIndex]; 49 } 50 public Object [] getObject(int[] columnIndexes)throws DException{ 51 Object [] values = new Object [columnIndexes.length]; 52 for (int i = 0; i < columnIndexes.length; i++) { 53 values[i] = getObject(columnIndexes[i]); 54 } 55 return values; 56 } 57 58 public Object getObject(String columnName)throws DException{ 59 int index = tableCharacteristics.getIndexForColumnName(columnName); 60 if(index == -1) 61 throw DatabaseConstants.COLUMN_NOTFOUND_EXCEPTION; 62 return object[index]; 63 } 64 public Object [] getObject(String [] columnName)throws DException{ 65 Object [] values = new Object [columnName.length]; 66 for (int i = 0; i < columnName.length; i++) { 67 values[i] = getObject(columnName[i]); 68 } 69 return values; 70 } 71 72 public Object [] getObject() throws DException{ 73 return object; 74 } 75 76 public Object clone() { 77 Object [] temp = new Object [object.length]; 78 System.arraycopy( object,0,temp,0,object.length ); 79 clone1(temp); 80 return new Record(tableCharacteristics,temp); 81 } 82 83 private Object [] clone1(Object [] values) { 84 FieldBase fb; 85 for (int i = 0; i < values.length; i++) { 86 fb = (FieldBase)values[i]; 87 fb.setBufferRange(fb.getNull() ? FieldUtility.NULLBUFFERRANGE : new BufferRange(fb.getBufferRange().getBytes())); 88 } 89 return values; 90 } 91 92 public int getColumnCount() throws DException{ 93 return tableCharacteristics.getColumnCount(); 94 } 95 96 public String toString(){ 97 return java.util.Arrays.asList(object).toString(); 98 } 99 100 public _Record getRecord(String parm1) throws com.daffodilwoods.database.resource.DException { 101 102 throw new java.lang.UnsupportedOperationException ("Method getRecord() not yet implemented."); 103 } 104 105 public Object getObject(_TableInfo parm1, int parm2) throws com.daffodilwoods.database.resource.DException { 106 return object[parm2]; 107 } 108 109 public Object getObject(_TableInfo parm1, String parm2) throws com.daffodilwoods.database.resource.DException { 110 return object[tableCharacteristics.getIndexForColumnName(parm2)]; 111 } 112 113 116 117 120 121 124 125 138 } 139 | Popular Tags |