예제 #1
0
  // This method checks the value of the "[applied]" column manually, to avoid instantiating an
  // ArrayBackedRow
  // object that we would throw away immediately.
  private static boolean checkWasApplied(List<ByteBuffer> firstRow, ColumnDefinitions metadata) {
    // If the column is not present or not a boolean, we assume the query
    // was not a conditional statement, and therefore return true.
    if (firstRow == null) return true;
    int[] is = metadata.findAllIdx("[applied]");
    if (is == null) return true;
    int i = is[0];
    if (!DataType.cboolean().equals(metadata.getType(i))) return true;

    // Otherwise return the value of the column
    ByteBuffer value = firstRow.get(i);
    if (value == null || value.remaining() == 0) return false;

    return TypeCodec.BooleanCodec.instance.deserializeNoBoxing(value);
  }