/** {@inheritDoc} */ @Override public Value value(GridKernalContext ctx) { return ValueInt.get(x); }
@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 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); }
@Override public Value getValue(Session session) { return ValueInt.get(prepared.getCurrentRowNumber()); }
public void setInt(int value) { this.expression = ValueExpression.get(ValueInt.get(value)); }
private void readParameterIndex() { int i = parseIndex; char[] chars = sqlCommandChars; char c = chars[i++]; long number = c - '0'; while (true) { c = chars[i]; if (c < '0' || c > '9') { currentValue = ValueInt.get((int) number); currentTokenType = VALUE; currentToken = "0"; parseIndex = i; break; } number = number * 10 + (c - '0'); if (number > Integer.MAX_VALUE) { throw DbException.getInvalidValueException( "parameter index", number); } i++; } }
/** * Create an ENUM value from the provided enumerators * and value. * * @param enumerators the enumerators * @param value a value * @return the ENUM value */ public static ValueEnum get(final String[] enumerators, int value) { check(enumerators, ValueInt.get(value)); return new ValueEnum(enumerators, 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); } }
/** * 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 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); } }
private void checkMetaFree(Session session, int id) { SearchRow r = meta.getTemplateSimpleRow(false); r.setValue(0, ValueInt.get(id)); Cursor cursor = metaIdIndex.find(session, r, r); if (cursor.next()) { DbException.throwInternalError(); } }
/** * INTERNAL */ public void setQueryTimeout(int seconds) throws SQLException { try { debugCodeCall("setQueryTimeout", seconds); checkClosed(); setQueryTimeout = prepareCommand("SET QUERY_TIMEOUT ?", setQueryTimeout); setQueryTimeout.getParameters().get(0) .setValue(ValueInt.get(seconds * 1000), false); setQueryTimeout.executeUpdate(false); queryTimeoutCache = seconds; } 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); } }
setLockMode.getParameters().get(0).setValue(ValueInt.get(lockMode), false); setLockMode.executeUpdate(false);
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);
if (id > 0 && !starting) { SearchRow r = meta.getTemplateSimpleRow(false); r.setValue(0, ValueInt.get(id)); boolean wasLocked = lockMeta(session); Cursor cursor = metaIdIndex.find(session, r, r);