1 5 package org.h2.result; 6 7 import java.sql.SQLException ; 8 9 import org.h2.store.DataPage; 10 import org.h2.store.Record; 11 import org.h2.value.Value; 12 13 16 public class Row extends Record implements SearchRow { 17 private Value[] data; 18 19 public Row(Value[] data) { 20 this.data = data; 21 } 22 23 public Row(Row old) { 24 this.data = old.data; 25 } 26 27 public Row() { 28 } 30 31 public Value getValue(int i) { 32 return data[i]; 33 } 34 35 public void write(DataPage buff) throws SQLException { 36 buff.writeInt(data.length); 37 for (int i = 0; i < data.length; i++) { 38 Value v = data[i]; 39 buff.writeValue(v); 40 } 41 } 42 43 public int getByteCount(DataPage dummy) throws SQLException { 44 int len = data.length; 45 int size = dummy.getIntLen(); 46 for (int i = 0; i < len; i++) { 47 Value v = data[i]; 48 size += dummy.getValueLen(v); 49 } 50 return size; 51 } 52 53 public void setValue(int i, Value v) { 54 data[i] = v; 55 } 56 57 public boolean isEmpty() { 58 return data == null; 59 } 60 61 public int getColumnCount() { 62 return data.length; 63 } 64 65 } 66 | Popular Tags |