コード例 #1
0
ファイル: RangeVariable.java プロジェクト: Eonblast/voltdb
    /** Uses multiple EQUAL expressions */
    private void getFirstRowMulti() {

      boolean convertible = true;
      Object[] currentJoinData = new Object[rangeVar.rangeIndex.getVisibleColumns()];

      for (int i = 0; i < rangeVar.multiColumnCount; i++) {
        Type valueType = rangeVar.findFirstExpressions[i].getRightNode().getDataType();
        Type targetType = rangeVar.findFirstExpressions[i].getLeftNode().getDataType();
        Object value = rangeVar.findFirstExpressions[i].getRightNode().getValue(session);

        if (targetType.compareToTypeRange(value) != 0) {
          convertible = false;

          break;
        }

        currentJoinData[i] = targetType.convertToType(session, value, valueType);
      }

      it =
          convertible
              ? rangeVar.rangeIndex.findFirstRow(
                  session, store, currentJoinData, rangeVar.multiColumnCount)
              : rangeVar.rangeIndex.emptyIterator();
    }
コード例 #2
0
ファイル: RangeVariable.java プロジェクト: Eonblast/voltdb
    private void getFirstRow() {

      Object value = rangeVar.indexCondition.getRightNode().getValue(session);
      Type valueType = rangeVar.indexCondition.getRightNode().getDataType();
      Type targetType = rangeVar.indexCondition.getLeftNode().getDataType();
      int exprType = rangeVar.indexCondition.getType();
      int range = 0;

      if (targetType != valueType) {
        range = targetType.compareToTypeRange(value);
      }

      if (range == 0) {
        value = targetType.convertToType(session, value, valueType);
        it = rangeVar.rangeIndex.findFirstRow(session, store, value, exprType);
      } else if (range < 0) {
        switch (exprType) {
          case OpTypes.GREATER_EQUAL:
          case OpTypes.GREATER:
            it = rangeVar.rangeIndex.findFirstRowNotNull(session, store);
            break;

          default:
            it = rangeVar.rangeIndex.emptyIterator();
        }
      } else {
        switch (exprType) {
          case OpTypes.SMALLER_EQUAL:
          case OpTypes.SMALLER:
            it = rangeVar.rangeIndex.findFirstRowNotNull(session, store);
            break;

          default:
            it = rangeVar.rangeIndex.emptyIterator();
        }
      }

      return;
    }
コード例 #3
0
  protected void writeDaySecondInterval(IntervalSecondData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
コード例 #4
0
  protected void writeYearMonthInterval(IntervalMonthData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
コード例 #5
0
  protected void writeTimestamp(TimestampData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
コード例 #6
0
 protected void writeDecimal(BigDecimal o, Type type) {
   writeBytes(type.convertToSQLString(o));
 }