Exemplo n.º 1
0
    /** 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();
    }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
  protected void writeDaySecondInterval(IntervalSecondData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
Exemplo n.º 4
0
  protected void writeYearMonthInterval(IntervalMonthData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
Exemplo n.º 5
0
  protected void writeTimestamp(TimestampData o, Type type) {

    write('\'');
    writeBytes(type.convertToString(o));
    write('\'');
  }
Exemplo n.º 6
0
 protected void writeDecimal(BigDecimal o, Type type) {
   writeBytes(type.convertToSQLString(o));
 }