コード例 #1
0
ファイル: LobStoreMem.java プロジェクト: BenKoerber/voltdb
  public byte[] getBlockBytes(int blockAddress, int blockCount) {

    byte[] dataBytes = new byte[blockCount * lobBlockSize];
    int dataBlockOffset = 0;

    while (blockCount > 0) {
      int largeBlockIndex = blockAddress / blocksInLargeBlock;
      byte[] largeBlock = (byte[]) byteStoreList.get(largeBlockIndex);
      int blockOffset = blockAddress % blocksInLargeBlock;
      int currentBlockCount = blockCount;

      if ((blockOffset + currentBlockCount) > blocksInLargeBlock) {
        currentBlockCount = blocksInLargeBlock - blockOffset;
      }

      System.arraycopy(
          largeBlock,
          blockOffset * lobBlockSize,
          dataBytes,
          dataBlockOffset * lobBlockSize,
          currentBlockCount * lobBlockSize);

      blockAddress += currentBlockCount;
      dataBlockOffset += currentBlockCount;
      blockCount -= currentBlockCount;
    }

    return dataBytes;
  }
コード例 #2
0
ファイル: RangeVariable.java プロジェクト: Eonblast/voltdb
  /** Add all columns to a list of expressions */
  void addTableColumns(HsqlArrayList exprList) {

    if (namedJoinColumns != null) {
      int count = exprList.size();
      int position = 0;

      for (int i = 0; i < count; i++) {
        Expression e = (Expression) exprList.get(i);
        String columnName = e.getColumnName();

        if (namedJoinColumns.contains(columnName)) {
          if (position != i) {
            exprList.remove(i);
            exprList.add(position, e);
          }

          e = getColumnExpression(columnName);

          exprList.set(position, e);

          position++;
        }
      }
    }

    addTableColumns(exprList, exprList.size(), namedJoinColumns);
  }
コード例 #3
0
ファイル: LobStoreMem.java プロジェクト: BenKoerber/voltdb
  public void setBlockBytes(byte[] dataBytes, int blockAddress, int blockCount) {

    int dataBlockOffset = 0;

    while (blockCount > 0) {
      int largeBlockIndex = blockAddress / blocksInLargeBlock;
      int largeBlockLimit = (blockAddress + blockCount) / blocksInLargeBlock;

      if ((blockAddress + blockCount) % blocksInLargeBlock != 0) {
        largeBlockLimit++;
      }

      if (largeBlockIndex >= byteStoreList.size()) {
        byteStoreList.add(new byte[largeBlockSize]);
      }

      byte[] largeBlock = (byte[]) byteStoreList.get(largeBlockIndex);
      int blockOffset = blockAddress % blocksInLargeBlock;
      int currentBlockCount = blockCount;

      if ((blockOffset + currentBlockCount) > blocksInLargeBlock) {
        currentBlockCount = blocksInLargeBlock - blockOffset;
      }

      System.arraycopy(
          dataBytes,
          dataBlockOffset * lobBlockSize,
          largeBlock,
          blockOffset * lobBlockSize,
          currentBlockCount * lobBlockSize);

      blockAddress += currentBlockCount;
      dataBlockOffset += currentBlockCount;
      blockCount -= currentBlockCount;
    }
  }