public Value[] getValueListWithVersion() { int len = data.length; Value[] d2 = new Value[len + 1]; System.arraycopy(data, 0, d2, 0, len); d2[len] = ValueInt.get(version); return d2; }
@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); }
@Override public Value readValue(ByteBuffer buff, int tag) { switch (tag) { case INT: return ValueInt.get(DataUtils.readVarInt(buff)); case TAG_INTEGER_NEGATIVE: return ValueInt.get(-DataUtils.readVarInt(buff)); case TAG_INTEGER_FIXED: return ValueInt.get(buff.getInt()); } return ValueInt.get(tag - TAG_INTEGER_0_15); }
@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); }
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(ServerSession session) { return ValueInt.get(prepared.getCurrentRowNumber()); }
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); }
private Cursor getMetaCursor(ServerSession session, int id) { SearchRow r = meta.getTemplateSimpleRow(false); r.setValue(0, ValueInt.get(id)); return metaIdIndex.find(session, r, r); }
/** * 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); } }
/** * 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(); 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); } }
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);
/** * Remove the given object from the meta data. * * @param session the session * @param id the id of the object to remove */ public void removeMeta(ServerSession session, int id) { if (id > 0 && !starting) { SearchRow r = meta.getTemplateSimpleRow(false); r.setValue(0, ValueInt.get(id)); Cursor cursor = metaIdIndex.find(session, r, r); if (cursor.next()) { Row found = cursor.get(); meta.removeRow(session, found); synchronized (objectIds) { objectIds.clear(id); } } } }
setLockMode.getParameters().get(0).setValue(ValueInt.get(lockMode), false); setLockMode.executeUpdate(); } catch (Exception e) {
DataType dt = DataType.getDataType(type); if (dt.decimal) { value = ValueInt.get(0).convertTo(type); } else if (dt.type == Value.TIMESTAMP) { value = ValueTimestamp.get(new Timestamp(session.getTransactionStart()));
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);