@Override public int getType() { return lastValue.getType(); }
@Override public int getType() { return value.getType(); }
@Override public int getType() { return value == null ? dataType : value.getType(); }
@Override public int getType() { if (value != null) { return value.getType(); } if (column != null) { return column.getType(); } return Value.UNKNOWN; }
/** * Get the memory used by this object. * * @return the memory used in bytes */ public int getMemory() { return DataType.getDataType(getType()).memory; }
private static long length(Value v) { switch (v.getType()) { case Value.BLOB: case Value.CLOB: case Value.BYTES: case Value.JAVA_OBJECT: return v.getPrecision(); default: return v.getString().length(); } }
/** {@inheritDoc} */ @Override public boolean equals(Object other) { if (!(other instanceof Value)) return false; Value otherVal = (Value)other; return otherVal.getType() == Value.JAVA_OBJECT && getObject().equals(otherVal.getObject()); }
/** * Throw the exception that the feature is not support for the given data * type. * * @param op the operation * @return never returns normally * @throws DbException the exception */ protected DbException throwUnsupportedExceptionForType(String op) { throw DbException.getUnsupportedException( DataType.getDataType(getType()).name + " " + op); }
private void writeValue(Value v) throws IOException { if (v.getType() == Value.CLOB || v.getType() == Value.BLOB) { if (v instanceof ValueLobDb) { ValueLobDb lob = (ValueLobDb) v; if (lob.isStored()) { long id = lob.getLobId(); lobs.put(id, new CachedInputStream(null)); } } } transfer.writeValue(v); }
@Override public void createIndexConditions(Session session, TableFilter filter) { if (value.getType() == Value.BOOLEAN) { boolean v = ((ValueBoolean) value).getBoolean(); if (!v) { filter.addIndexCondition(IndexCondition.get(Comparison.FALSE, null, this)); } } }
private static Value divide(Value a, long by) { if (by == 0) { return ValueNull.INSTANCE; } int type = Value.getHigherOrder(a.getType(), Value.LONG); Value b = ValueLong.get(by).convertTo(type); a = a.convertTo(type).divide(b); return a; }
public ResultSet getResultSet() { SimpleResultSet rs = new SimpleResultSet(); rs.setAutoClose(false); rs.addColumn("X", DataType.convertTypeToSQLType(getType()), MathUtils.convertLongToInt(getPrecision()), getScale()); rs.addRow(getObject()); return rs; }