@Override public long getPrecision() { long p = 0; for (Value v : values) { p += v.getPrecision(); } return p; }
/** * Check if the precision is smaller or equal than the given precision. * * @param precision the maximum precision * @return true if the precision of this value is smaller or equal to the * given precision */ public boolean checkPrecision(long precision) { return getPrecision() <= precision; }
@Override public long getPrecision() { return value == null ? precision : value.getPrecision(); }
@Override public long getPrecision() { return value.getPrecision(); }
@Override public long getPrecision() { return lastValue.getPrecision(); }
@Override public long getPrecision() { if (value != null) { return value.getPrecision(); } if (column != null) { return column.getPrecision(); } return 0; }
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(); } }
@Override public Value convertPrecision(long precision, boolean force) { if (!force) { return this; } int length = values.length; Value[] newValues = new Value[length]; int i = 0; boolean modified = false; for (; i < length; i++) { Value old = values[i]; Value v = old.convertPrecision(precision, true); if (v != old) { modified = true; } // empty byte arrays or strings have precision 0 // they count as precision 1 here precision -= Math.max(1, v.getPrecision()); if (precision < 0) { break; } newValues[i] = v; } if (i < length) { return get(componentType, Arrays.copyOf(newValues, i)); } return modified ? get(componentType, newValues) : this; }
throw DbException.getInvalidValueException("pos", pos); if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision());
throw DbException.getInvalidValueException("pos", pos); if (value.getPrecision() != 0) { throw DbException.getInvalidValueException("length", value.getPrecision());
public ResultSet getResultSet() { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("X", DataType.convertTypeToSQLType(getType()), MathUtils.convertLongToInt(getPrecision()), getScale()); rs.addRow(getObject()); return rs; }
/** * Returns the length. * * @return the length * @throws SQLException */ @Override public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.BLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getInputStream(), null); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the length. * * @return the length */ @Override public long length() throws SQLException { try { debugCodeCall("length"); checkClosed(); if (value.getType() == Value.CLOB) { long precision = value.getPrecision(); if (precision > 0) { return precision; } } return IOUtils.copyAndCloseInput(value.getReader(), null, Long.MAX_VALUE); } catch (Exception e) { throw logAndConvert(e); } }
/** * Extracts expression columns from ValueArray * * @param session the current session * @param value the value to extract columns from * @return array of expression columns */ public static Expression[] getExpressionColumns(ServerSession session, ValueArray value) { Value[] list = value.getList(); ExpressionColumn[] expr = new ExpressionColumn[list.length]; for (int i = 0, len = list.length; i < len; i++) { Value v = list[i]; Column col = new Column("C" + (i + 1), v.getType(), v.getPrecision(), v.getScale(), v.getDisplaySize()); expr[i] = new ExpressionColumn(session.getDatabase(), col); } return expr; }
s + " (" + value.getPrecision() + ")");
long length = v.getPrecision(); if (length < 0) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "length=" + length);
if (v.getPrecision() > lobBlockSize) { int id; if (v.getType() == Value.CLOB) {