コード例 #1
0
ファイル: PageDataLeaf.java プロジェクト: zwqjsj0404/YourBase
 /**
  * Read a row from the data page at the given position.
  *
  * @param data the data page
  * @param pos the position to read from
  * @param columnCount the number of columns
  * @return the row
  */
 private static Row readRow(Data data, int pos, int columnCount) {
   Value[] values = new Value[columnCount];
   synchronized (data) {
     data.setPos(pos);
     for (int i = 0; i < columnCount; i++) {
       values[i] = data.readValue();
     }
   }
   return RegularTable.createRow(values);
 }
コード例 #2
0
ファイル: PageLog.java プロジェクト: nuxeo/h2database
 /**
  * Read a row from an input stream.
  *
  * @param in the input stream
  * @param data a temporary buffer
  * @return the row
  */
 public static Row readRow(DataReader in, Data data) throws IOException {
   long key = in.readVarLong();
   int len = in.readVarInt();
   data.reset();
   data.checkCapacity(len);
   in.readFully(data.getBytes(), len);
   int columnCount = data.readVarInt();
   Value[] values = new Value[columnCount];
   for (int i = 0; i < columnCount; i++) {
     values[i] = data.readValue();
   }
   Row row = new Row(values, Row.MEMORY_CALCULATE);
   row.setKey(key);
   return row;
 }
コード例 #3
0
 private void readRow(ResultDiskTape tape) {
   int min = Constants.FILE_BLOCK_SIZE;
   Data buff = rowBuff;
   buff.reset();
   file.readFully(buff.getBytes(), 0, min);
   int len = buff.readInt();
   buff.checkCapacity(len);
   if (len - min > 0) {
     file.readFully(buff.getBytes(), min, len - min);
   }
   tape.pos += len;
   Value[] row = new Value[columnCount];
   for (int k = 0; k < columnCount; k++) {
     row[k] = buff.readValue();
   }
   tape.buffer.add(row);
 }
コード例 #4
0
ファイル: RowList.java プロジェクト: kringpin323/H2-Research
 private Row readRow(Data buff) {
   if (buff.readByte() == 0) {
     return null;
   }
   int mem = buff.readInt();
   int columnCount = buff.readInt();
   long key = buff.readLong();
   int version = buff.readInt();
   if (readUncached) {
     key = 0;
   }
   boolean deleted = buff.readInt() == 1;
   int sessionId = buff.readInt();
   Value[] values = new Value[columnCount];
   for (int i = 0; i < columnCount; i++) {
     Value v;
     if (buff.readByte() == 0) {
       v = null;
     } else {
       v = buff.readValue();
       if (v.isLinked()) {
         // the table id is 0 if it was linked when writing
         // a temporary entry
         if (v.getTableId() == 0) {
           session.unlinkAtCommit(v);
         }
       }
     }
     values[i] = v;
   }
   Row row = new Row(values, mem);
   row.setKey(key);
   row.setVersion(version);
   row.setDeleted(deleted);
   row.setSessionId(sessionId);
   return row;
 }