@Override public Value divide(Value v) { ValueInt other = (ValueInt) v; if (other.value == 0) { throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL()); } return ValueInt.get(value / other.value); }
private static ValueInt checkRange(long x) { if (x < Integer.MIN_VALUE || x > Integer.MAX_VALUE) { throw DbException.get(ErrorCode.NUMERIC_VALUE_OUT_OF_RANGE_1, Long.toString(x)); } return ValueInt.get((int) x); }
@Override public Value getValue(Session session) { return ValueInt.get(prepared.getCurrentRowNumber()); }
@Override public Value modulus(Value v) { ValueInt other = (ValueInt) v; if (other.value == 0) { throw DbException.get(ErrorCode.DIVISION_BY_ZERO_1, getSQL()); } return ValueInt.get(value % other.value); }
public void setInt(int value) { this.expression = ValueExpression.get(ValueInt.get(value)); }
@Override Value getValue(Database database, int dataType, boolean distinct) { if (distinct) { count = 0; } Value v = null; int s = 0; if (count == 0) { s = 0; } else { m2 += distinctHashes.size(); m2 = 100 * m2 / count; s = (int) m2; s = s <= 0 ? 1 : s > 100 ? 100 : s; } v = ValueInt.get(s); return v.convertTo(dataType); } }
/** * 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 updateInt(int columnIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt(" + columnIndex + ", " + x + ");"); } update(columnIndex, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
/** * Sets the value of a parameter. * * @param parameterIndex the parameter index (1, 2, ...) * @param x the value * @throws SQLException if this object is closed */ @Override public void setInt(int parameterIndex, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("setInt(" + parameterIndex + ", " + x + ");"); } setParameter(parameterIndex, ValueInt.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 updateInt(String columnLabel, int x) throws SQLException { try { if (isDebugEnabled()) { debugCode("updateInt(" + quote(columnLabel) + ", " + x + ");"); } update(columnLabel, ValueInt.get(x)); } catch (Exception e) { throw logAndConvert(e); } }
int value = rs.getInt(columnIndex); v = rs.wasNull() ? (Value) ValueNull.INSTANCE : ValueInt.get(value); break;
return ValueLong.get(((Long) x).longValue()); } else if (x instanceof Integer) { return ValueInt.get(((Integer) x).intValue()); } else if (x instanceof BigDecimal) { return ValueDecimal.get((BigDecimal) x);
expressionSQL.add(sql); o.columnIndexExpr = ValueExpression.get(ValueInt.get(idx + 1)); Expression expr = expressions.get(idx).getNonAliasExpression(); o.expression = expr;
Function f = Function.getFunction(database, "ARRAY_GET"); f.setParameter(0, expression); f.setParameter(1, ValueExpression.get(ValueInt.get(i + 1))); f.doneWithParameters(); command.setAssignment(column, f);
command.setLimit(ValueExpression.get(ValueInt.get(1))); } else { Expression limit = readExpression().optimize(session);
f.setParameter(0, ValueExpression.get(ValueString.get("SECOND"))); left = new Operation(Operation.MULTIPLY, ValueExpression.get(ValueInt .get(60 * 60 * 24)), left); f.setParameter(1, left); f.setParameter(2, right); f.setParameter(0, ValueExpression.get(ValueString.get("SECOND"))); right = new Operation(Operation.MULTIPLY, ValueExpression.get(ValueInt .get(60 * 60 * 24)), right); right = new Operation(NEGATE, right, null); right = right.optimize(session);
l = Math.min(l, maxRows); limitExpr = ValueExpression.get(ValueInt.get(l));
function.setParameter(1, ValueExpression.get(ValueInt.get(0))); function.setParameter(2, readExpression()); } else {