org.h2.value.Value.getInt()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.h2.value.Value.getInt()方法的一些代码示例,展示了Value.getInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.getInt()方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:getInt

Value.getInt介绍

暂无

代码示例

代码示例来源:origin: com.h2database/h2

@Override
protected int compareSecure(final Value v, final CompareMode mode) {
  return Integer.compare(getInt(), v.getInt());
}

代码示例来源:origin: com.h2database/h2

@Override
protected int compareSecure(final Value v, final CompareMode mode) {
  return Integer.compare(getInt(), v.getInt());
}

代码示例来源:origin: com.h2database/h2

/**
 * Reserve the page if this is a index root page entry.
 *
 * @param logPos the redo log position
 * @param tableId the table id
 * @param row the row
 */
void allocateIfIndexRoot(int logPos, int tableId, Row row) {
  if (tableId == META_TABLE_ID) {
    int rootPageId = row.getValue(3).getInt();
    if (reservedPages == null) {
      reservedPages = new HashMap<>();
    }
    reservedPages.put(rootPageId, logPos);
  }
}

代码示例来源:origin: com.h2database/h2

public MetaRecord(SearchRow r) {
  id = r.getValue(0).getInt();
  objectType = r.getValue(2).getInt();
  sql = r.getValue(3).getString();
}

代码示例来源:origin: com.h2database/h2

@Override
public Object getObject() {
  int len = values.length;
  Object[] list = (Object[]) Array.newInstance(componentType, len);
  for (int i = 0; i < len; i++) {
    final Value value = values[i];
    if (!SysProperties.OLD_RESULT_SET_GET_OBJECT) {
      final int type = value.getType();
      if (type == Value.BYTE || type == Value.SHORT) {
        list[i] = value.getInt();
        continue;
      }
    }
    list[i] = value.getObject();
  }
  return list;
}

代码示例来源:origin: com.h2database/h2

private int getIntValue() {
  expression = expression.optimize(session);
  return expression.getValue(session).getInt();
}

代码示例来源:origin: apache/ignite

/**
 * @param val Value.
 */
public GridH2Integer(Value val) {
  assert val.getType() == Value.INT : val.getType();
  x = val.getInt();
}

代码示例来源:origin: com.h2database/h2

/**
 * Get the sample size, if set.
 *
 * @param session the session
 * @return the sample size
 */
int getSampleSizeValue(Session session) {
  if (sampleSizeExpr == null) {
    return 0;
  }
  Value v = sampleSizeExpr.optimize(session).getValue(session);
  if (v == ValueNull.INSTANCE) {
    return 0;
  }
  return v.getInt();
}

代码示例来源:origin: com.h2database/h2

@Override
public int update() {
  Value v = expression.getValue(session);
  int type = v.getType();
  switch (type) {
  case Value.RESULT_SET:
    // this will throw an exception
    // methods returning a result set may not be called like this.
    return super.update();
  case Value.UNKNOWN:
  case Value.NULL:
    return 0;
  default:
    return v.getInt();
  }
}

代码示例来源:origin: com.h2database/h2

/**
 * Returns the value of the specified column as an int.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public int getInt(int columnIndex) throws SQLException {
  try {
    debugCodeCall("getInt", columnIndex);
    return get(columnIndex).getInt();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/h2

/**
 * Returns the value of the specified column as an int.
 *
 * @param columnLabel the column label
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public int getInt(String columnLabel) throws SQLException {
  try {
    debugCodeCall("getInt", columnLabel);
    return get(columnLabel).getInt();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/h2

private void removeMeta(Row row) {
  int id = row.getValue(0).getInt();
  PageIndex index = metaObjects.get(id);
  index.getTable().removeIndex(index);
  if (index instanceof PageBtreeIndex || index instanceof PageDelegateIndex) {
    if (index.isTemporary()) {
      pageStoreSession.removeLocalTempTableIndex(index);
    } else {
      index.getSchema().remove(index);
    }
  }
  index.remove(pageStoreSession);
  metaObjects.remove(id);
}

代码示例来源:origin: com.h2database/h2

public BitField getObjectIds() {
  BitField f = new BitField();
  Cursor cursor = metaIndex.find(pageStoreSession, null, null);
  while (cursor.next()) {
    Row row = cursor.get();
    int id = row.getValue(0).getInt();
    if (id > 0) {
      f.set(id);
    }
  }
  return f;
}

代码示例来源:origin: com.h2database/h2

private int readInt() {
  boolean minus = false;
  if (currentTokenType == MINUS) {
    minus = true;
    read();
  } else if (currentTokenType == PLUS) {
    read();
  }
  if (currentTokenType != VALUE) {
    throw DbException.getSyntaxError(sqlCommand, parseIndex, "integer");
  }
  if (minus) {
    // must do that now, otherwise Integer.MIN_VALUE would not work
    currentValue = currentValue.negate();
  }
  int i = currentValue.getInt();
  read();
  return i;
}

代码示例来源:origin: com.h2database/h2

private void readMetaData() {
  Cursor cursor = metaIndex.find(pageStoreSession, null, null);
  // first, create all tables
  while (cursor.next()) {
    Row row = cursor.get();
    int type = row.getValue(1).getInt();
    if (type == META_TYPE_DATA_INDEX) {
      addMeta(row, pageStoreSession, false);
    }
  }
  // now create all secondary indexes
  // otherwise the table might not be created yet
  cursor = metaIndex.find(pageStoreSession, null, null);
  while (cursor.next()) {
    Row row = cursor.get();
    int type = row.getValue(1).getInt();
    if (type != META_TYPE_DATA_INDEX) {
      addMeta(row, pageStoreSession, false);
    }
  }
}

代码示例来源:origin: com.h2database/h2

private static Validation validate(final String[] enumerators, final Value value) {
    final Validation validation = validate(enumerators);
    if (!validation.equals(Validation.VALID)) {
      return validation;
    }

    if (DataType.isStringType(value.getType())) {
      final String cleanLabel = sanitize(value.getString());

      for (String enumerator : enumerators) {
        if (cleanLabel.equals(sanitize(enumerator))) {
          return Validation.VALID;
        }
      }

      return Validation.INVALID;
    } else {
      final int ordinal = value.getInt();

      if (ordinal < 0 || ordinal >= enumerators.length) {
        return Validation.INVALID;
      }

      return Validation.VALID;
    }
  }
}

代码示例来源:origin: com.h2database/h2

private void checkNoNullValues(Table table) {
  String sql = "SELECT COUNT(*) FROM " +
      table.getSQL() + " WHERE " +
      oldColumn.getSQL() + " IS NULL";
  Prepared command = session.prepare(sql);
  ResultInterface result = command.query(0);
  result.next();
  if (result.currentRow()[0].getInt() > 0) {
    throw DbException.get(
        ErrorCode.COLUMN_CONTAINS_NULL_VALUES_1,
        oldColumn.getSQL());
  }
}

代码示例来源:origin: com.h2database/h2

@Override
public Value getValue(Session session) {
  Select select = columnResolver.getSelect();
  if (select != null) {
    HashMap<Expression, Object> values = select.getCurrentGroup();
    if (values != null) {
      Value v = (Value) values.get(this);
      if (v != null) {
        return v;
      }
    }
  }
  Value value = columnResolver.getValue(column);
  if (value == null) {
    if (select == null) {
      throw DbException.get(ErrorCode.NULL_NOT_ALLOWED, getSQL());
    } else {
      throw DbException.get(ErrorCode.MUST_GROUP_BY_COLUMN_1, getSQL());
    }
  }
  if (column.getEnumerators() != null && value != ValueNull.INSTANCE) {
    return ValueEnum.get(column.getEnumerators(), value.getInt());
  }
  return value;
}

代码示例来源:origin: com.h2database/h2

/**
 * INTERNAL
 */
int getQueryTimeout() throws SQLException {
  try {
    if (queryTimeoutCache == -1) {
      checkClosed();
      getQueryTimeout = prepareCommand(
          "SELECT VALUE FROM INFORMATION_SCHEMA.SETTINGS "
              + "WHERE NAME=?",
          getQueryTimeout);
      getQueryTimeout.getParameters().get(0)
          .setValue(ValueString.get("QUERY_TIMEOUT"), false);
      ResultInterface result = getQueryTimeout.executeQuery(0, false);
      result.next();
      int queryTimeout = result.currentRow()[0].getInt();
      result.close();
      if (queryTimeout != 0) {
        // round to the next second, otherwise 999 millis would
        // return 0 seconds
        queryTimeout = (queryTimeout + 999) / 1000;
      }
      queryTimeoutCache = queryTimeout;
    }
    return queryTimeoutCache;
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/h2

case Value.SHORT:
  if (!SysProperties.OLD_RESULT_SET_GET_OBJECT) {
    return v.getInt();

相关文章