@Override public Value convertPrecision(long precision, boolean force) { if (value.length <= precision) { return this; } int len = MathUtils.convertLongToInt(precision); byte[] buff = new byte[len]; System.arraycopy(value, 0, buff, 0, len); return get(buff); }
/** * Updates a column in the current or insert row. * * @param columnIndex (1,2,...) * @param x the value * @throws SQLException if the result set is closed or not updatable */ @Override public void updateBytes(int columnIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes(" + columnIndex + ", x);"); } update(columnIndex, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
/** * Updates a column in the current or insert row. * * @param columnLabel the column label * @param x the value * @throws SQLException if the result set is closed or not updatable */ @Override public void updateBytes(String columnLabel, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateBytes(" + quote(columnLabel) + ", x);"); } update(columnLabel, x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
/** * Sets the value of a parameter as a byte array. * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value * @throws SQLException if this object is closed */ @Override public void setBytes(int parameterIndex, byte[] x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setBytes(" + parameterIndex + ", " + quoteBytes(x) + ");"); } Value v = x == null ? (Value) ValueNull.INSTANCE : ValueBytes.get(x); setParameter(parameterIndex, v); } catch (Exception e) { throw logAndConvert(e); } }
return ValueDouble.get(((Double) x).doubleValue()); } else if (x instanceof byte[]) { return ValueBytes.get((byte[]) x); } else if (x instanceof Date) { return ValueDate.get((Date) x);