@Override public int getDisplaySize() { return MathUtils.convertLongToInt(value.length * 2L); }
int getPrecisionAsInt() { return MathUtils.convertLongToInt(precision); }
@Override public Value convertPrecision(long precision, boolean force) { if (precision == 0 || value.length() <= precision) { return this; } int p = MathUtils.convertLongToInt(precision); return getNew(value.substring(0, p)); }
@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); }
@Override public int getDisplaySize() { // add 2 characters for '-' and '.' return MathUtils.convertLongToInt(getPrecision() + 2); }
@Override public int getDisplaySize() { long size = 0; for (Value v : values) { size += v.getDisplaySize(); } return MathUtils.convertLongToInt(size); }
@Override public int getDisplaySize() { return MathUtils.convertLongToInt(getPrecision()); }
@Override public int getDisplaySize() { return MathUtils.convertLongToInt(getPrecision()); }
/** * Returns the value as a String. * * @param columnIndex (1,2,...) * @return the value */ @Override public String getString(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o == null) { return null; } switch (columns.get(columnIndex - 1).sqlType) { case Types.CLOB: Clob c = (Clob) o; return c.getSubString(1, MathUtils.convertLongToInt(c.length())); } return o.toString(); }
private static int getBufferSize( long remaining) { if (remaining < 0 || remaining > Integer.MAX_VALUE) { remaining = Integer.MAX_VALUE; } int inplace = /*handler.*/getMaxLengthInplaceLob(); long m = Constants.IO_BUFFER_SIZE; if (m < remaining && m <= inplace) { // using "1L" to force long arithmetic because // inplace could be Integer.MAX_VALUE m = Math.min(remaining, inplace + 1L); // the buffer size must be bigger than the inplace lob, otherwise we // can't know if it must be stored in-place or not m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE); } m = Math.min(remaining, m); m = MathUtils.convertLongToInt(m); if (m < 0) { m = Integer.MAX_VALUE; } return (int) m; }
private static int getBufferSize( long remaining) { if (remaining < 0 || remaining > Integer.MAX_VALUE) { remaining = Integer.MAX_VALUE; } int inplace = getMaxLengthInplaceLob(); long m = Constants.IO_BUFFER_SIZE; if (m < remaining && m <= inplace) { // using "1L" to force long arithmetic m = Math.min(remaining, inplace + 1L); // the buffer size must be bigger than the inplace lob, otherwise we // can't know if it must be stored in-place or not m = MathUtils.roundUpLong(m, Constants.IO_BUFFER_SIZE); } m = Math.min(remaining, m); m = MathUtils.convertLongToInt(m); if (m < 0) { m = Integer.MAX_VALUE; } return (int) m; }
@Override public int getDisplaySize() { if (right != null) { switch (opType) { case CONCAT: return MathUtils.convertLongToInt((long) left.getDisplaySize() + (long) right.getDisplaySize()); default: return Math.max(left.getDisplaySize(), right.getDisplaySize()); } } return left.getDisplaySize(); }
/** * Gets the precision for this column. * * @param column the column index (1,2,...) * @return the precision * @throws SQLException if the result set is closed or invalid */ @Override public int getPrecision(int column) throws SQLException { try { debugCodeCall("getPrecision", column); checkColumnIndex(column); long prec = result.getColumnPrecision(--column); return MathUtils.convertLongToInt(prec); } catch (Exception e) { throw logAndConvert(e); } }
/** * Returns the parameter precision. * The value 0 is returned if the precision is not known. * * @param param the column index (1,2,...) * @return the precision */ @Override public int getPrecision(int param) throws SQLException { try { debugCodeCall("getPrecision", param); ParameterInterface p = getParameter(param); return MathUtils.convertLongToInt(p.getPrecision()); } catch (Exception e) { throw logAndConvert(e); } }
int scale = rs.getInt("DECIMAL_DIGITS"); scale = convertScale(sqlType, scale); int displaySize = MathUtils.convertLongToInt(precision); int type = DataType.convertSQLTypeToValueType(sqlType); Column col = new Column(n, type, precision, scale, displaySize);
for (Expression e : args) { precision += e.getPrecision(); displaySize = MathUtils.convertLongToInt( (long) displaySize + e.getDisplaySize()); if (precision < 0) { case HEXTORAW: precision = (args[0].getPrecision() + 3) / 4; displaySize = MathUtils.convertLongToInt(precision); break; case LCASE: case RAWTOHEX: precision = args[0].getPrecision() * 4; displaySize = MathUtils.convertLongToInt(precision); break; case SOUNDEX:
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; }
private static SimpleResultSet getSimpleResultSet(ResultInterface rs, int maxrows) { int columnCount = rs.getVisibleColumnCount(); SimpleResultSet simple = new SimpleResultSet(); simple.setAutoClose(false); for (int i = 0; i < columnCount; i++) { String name = rs.getColumnName(i); int sqlType = DataType.convertTypeToSQLType(rs.getColumnType(i)); int precision = MathUtils.convertLongToInt(rs.getColumnPrecision(i)); int scale = rs.getColumnScale(i); simple.addColumn(name, sqlType, precision, scale); } rs.reset(); for (int i = 0; i < maxrows && rs.next(); i++) { Object[] list = new Object[columnCount]; for (int j = 0; j < columnCount; j++) { list[j] = rs.currentRow()[j].getObject(); } simple.addRow(list); } return simple; }
d = MathUtils.convertLongToInt(p); break;
scale = MathUtils.convertLongToInt(p); p = precision; } else { displaySize = MathUtils.convertLongToInt(precision); original += ")";