@Override public QueryBinder<ENTITY> setDecimal(int i, BigDecimal v) { for (BoundStatement statement : statements.values()) { statement.setDecimal(i, v); } return this; }
@Test(groups = "short") public void should_use_default_codecs_with_prepared_statements_2() { session() .execute( session() .prepare(insertQuery) .bind() .setInt(0, n_int) .setLong(1, n_bigint) .setFloat(2, n_float) .setDouble(3, n_double) .setVarint(4, n_varint) .setDecimal(5, n_decimal)); PreparedStatement ps = session().prepare(selectQuery); ResultSet rows = session().execute(ps.bind().setInt(0, n_int).setLong(1, n_bigint)); Row row = rows.one(); assertRow(row); }
@Override public QueryBinder<ENTITY> setDecimal(String name, BigDecimal v) { for (BoundStatement statement : statements.values()) { if (statement.preparedStatement().getVariables().contains(name)) { statement.setDecimal(name, v); } } return this; }
public void setBigDecimal(int parameterIndex, BigDecimal decimal) throws SQLException { checkNotClosed(); checkIndex(parameterIndex); this.statement.setDecimal(parameterIndex-1, decimal); //bindValues.put(parameterIndex, decimal == null ? null : JdbcDecimal.instance.decompose(decimal)); }
break; case Types.DECIMAL: this.statement.setDecimal(parameterIndex-1, (BigDecimal)object); break; case Types.DOUBLE:
case DECIMAL: final BigDecimal decimal = ((Getter<Object, BigDecimal>)getters.get(i)).get(tuple); boundStmnt.setDecimal(i, decimal); break; case SET:
case DECIMAL: final BigDecimal decimal = ((Getter<Object, BigDecimal>)getters.get(i)).get(tuple); boundStmnt.setDecimal(i, decimal); break; case SET:
bstm.setBytes(key, (ByteBuffer) value); } else if (value instanceof BigDecimal) { bstm.setDecimal(key, (BigDecimal) value); } else if (value instanceof Double) { bstm.setDouble(key, ((Double) value).doubleValue());
bstm.setBytes(i, (ByteBuffer) value); } else if (value instanceof BigDecimal) { bstm.setDecimal(i, (BigDecimal) value); } else if (value instanceof Double) { bstm.setDouble(i, ((Double) value).doubleValue());
boundStatement.unset(cassandraColName); } else { boundStatement.setDecimal(cassandraColName, null); boundStatement.setDecimal(cassandraColName, decimal);
boundStatement.unset(cassandraColName); } else { boundStatement.setDecimal(cassandraColName, null); boundStatement.setDecimal(cassandraColName, decimal);
@Test(groups = "short") public void should_use_default_codecs_with_prepared_statements_2() { session() .execute( session() .prepare(insertQuery) .bind() .setInt(0, n_int) .setLong(1, n_bigint) .setFloat(2, n_float) .setDouble(3, n_double) .setVarint(4, n_varint) .setDecimal(5, n_decimal)); PreparedStatement ps = session().prepare(selectQuery); ResultSet rows = session().execute(ps.bind().setInt(0, n_int).setLong(1, n_bigint)); Row row = rows.one(); assertRow(row); }