热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.datastax.driver.core.BoundStatement.setDouble()方法的使用及代码示例

本文整理了Java中com.datastax.driver.core.BoundStatement.setDouble()方法的一些代码示例,展示了Boun

本文整理了Java中com.datastax.driver.core.BoundStatement.setDouble()方法的一些代码示例,展示了BoundStatement.setDouble()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BoundStatement.setDouble()方法的具体详情如下:
包路径:com.datastax.driver.core.BoundStatement
类名称:BoundStatement
方法名:setDouble

BoundStatement.setDouble介绍

[英]Sets the ith value to the provided double.
[中]将第i个值设置为提供的双精度值。

代码示例

代码示例来源:origin: apache/nifi

statement.setDouble(paramIndex, (double) typeCodec.parse(paramValue));

代码示例来源:origin: org.caffinitas.mapper/caffinitas-mapper-core

@Override public QueryBinder setDouble(int i, double v) {
for (BoundStatement statement : statements.values()) {
statement.setDouble(i, v);
}
return this;
}

代码示例来源:origin: com.datastax.cassandra/cassandra-driver-core

@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);
}

代码示例来源:origin: scalar-labs/scalardb

/**
* Sets the specified {@code DoubleValue} to the bound statement
*
* @param value a {@code DoubleValue} to be set
*/
@Override
public void visit(DoubleValue value) {
LOGGER.debug(value.get() + " is bound to " + i);
bound.setDouble(i++, value.get());
}

代码示例来源:origin: adejanovski/cassandra-jdbc-wrapper

public void setDouble(int parameterIndex, double decimal) throws SQLException
{
checkNotClosed();
checkIndex(parameterIndex);
//bindValues.put(parameterIndex, JdbcDouble.instance.decompose(decimal));
this.statement.setDouble(parameterIndex-1, decimal);
}

代码示例来源:origin: org.caffinitas.mapper/caffinitas-mapper-core

@Override public QueryBinder setDouble(String name, double v) {
for (BoundStatement statement : statements.values()) {
if (statement.preparedStatement().getVariables().contains(name)) {
statement.setDouble(name, v);
}
}
return this;
}

代码示例来源:origin: org.hawkular.metrics/hawkular-metrics-core-service

private void bindValue(BoundStatement bs, MetricType type, DataPoint dataPoint) {
switch(type.getCode()) {
case 0:
bs.setDouble(0, (Double) dataPoint.getValue());
break;
case 1:
bs.setBytes(0, getBytes((DataPoint) dataPoint));
break;
case 2:
bs.setLong(0, (Long) dataPoint.getValue());
break;
case 3:
bs.setLong(0, (Long) dataPoint.getValue());
break;
case 4:
throw new IllegalArgumentException("Not implemented yet");
case 5:
bs.setDouble(0, (Double) dataPoint.getValue());
break;
default:
throw new IllegalArgumentException("Unsupported metricType");
}
}

代码示例来源:origin: hawkular/hawkular-metrics

private void bindValue(BoundStatement bs, MetricType type, DataPoint dataPoint) {
switch(type.getCode()) {
case 0:
bs.setDouble(0, (Double) dataPoint.getValue());
break;
case 1:
bs.setBytes(0, getBytes((DataPoint) dataPoint));
break;
case 2:
bs.setLong(0, (Long) dataPoint.getValue());
break;
case 3:
bs.setLong(0, (Long) dataPoint.getValue());
break;
case 4:
throw new IllegalArgumentException("Not implemented yet");
case 5:
bs.setDouble(0, (Double) dataPoint.getValue());
break;
default:
throw new IllegalArgumentException("Unsupported metricType");
}
}

代码示例来源:origin: scalar-labs/scalardb

@Test
public void visit_DoubleValueAcceptCalled_ShouldCallSetDouble() {
// Arrange
DoubleValue value = new DoubleValue(ANY_NAME, ANY_DOUBLE);
ValueBinder binder = new ValueBinder(bound);
// Act
value.accept(binder);
// Assert
verify(bound).setDouble(0, ANY_DOUBLE);
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public void insertRanges(final byte[][] ids, final double value) throws DataAccessLayerException {
/*
* insert in CF_RN_SP_O
*/
final BoundStatement nspoStatement = _insertNSPOStatement.bind();
nspoStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0]));
nspoStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[1]));
nspoStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[2]));
nspoStatement.setDouble(3, value);
_batchStatements.get().add(nspoStatement);
/*
* insert in CF_RN_P_OS
*/
final BoundStatement nposStatement = _insertNPOSStatement.bind();
nposStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[1]));
nposStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[2]));
nposStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[0]));
nposStatement.setDouble(3, value);
_batchStatements.get().add(nposStatement);
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public void insertRanges(final byte[][] ids, final double value) throws DataAccessLayerException {
/*
* insert in CF_RN_SP_O
*/
final BoundStatement nspoStatement = _insertNSPOStatement.bind();
nspoStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[0]));
nspoStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[1]));
nspoStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[2]));
nspoStatement.setDouble(3, value);
_batchStatements.get().add(nspoStatement);
/*
* insert in CF_RN_P_OS
*/
final BoundStatement nposStatement = _insertNPOSStatement.bind();
nposStatement.setBytesUnsafe(0, ID_SERIALIZER.serialize(ids[1]));
nposStatement.setBytesUnsafe(1, ID_SERIALIZER.serialize(ids[2]));
nposStatement.setBytesUnsafe(2, ID_SERIALIZER.serialize(ids[0]));
nposStatement.setDouble(3, value);
_batchStatements.get().add(nposStatement);
}

代码示例来源:origin: apache/apex-malhar

case DOUBLE:
final double doubleValue = ((GetterDouble)getters.get(i)).get(tuple);
boundStmnt.setDouble(i, doubleValue);
break;
case DECIMAL:

代码示例来源:origin: org.apache.apex/malhar-contrib

case DOUBLE:
final double doubleValue = ((GetterDouble)getters.get(i)).get(tuple);
boundStmnt.setDouble(i, doubleValue);
break;
case DECIMAL:

代码示例来源:origin: com.github.ddth/ddth-cql-utils

bstm.setDecimal(key, (BigDecimal) value);
} else if (value instanceof Double) {
bstm.setDouble(key, ((Double) value).doubleValue());
} else if (value instanceof Float) {
bstm.setFloat(key, ((Float) value).floatValue());

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public Iterator dateRangeQuery(
final Value[] query,
final long lowerBound,
final boolean equalsLower,
final long upperBound,
final boolean equalsUpper,
final boolean reverse,
final int limit) throws DataAccessLayerException {
final byte[] s = _dictionary.getID(query[0], false);
final byte[] p = _dictionary.getID(query[1], true);
final boolean subjectIsVariable = isVariable(s);

final BoundStatement statement = _rangeQueries[getRangeQueryIndex(reverse, subjectIsVariable, false, !equalsUpper, !equalsLower)].bind();
int queryParameterIndex = 0;
if (!subjectIsVariable) {
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(s));
}
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(p));
statement.setDouble(queryParameterIndex++, lowerBound);
statement.setDouble(queryParameterIndex++, upperBound);
statement.setInt(queryParameterIndex, limit);
return new SPOCResultIterator(_session.executeAsync(statement), false);
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public Iterator dateRangeQuery(
final Value[] query,
final long lowerBound,
final boolean equalsLower,
final long upperBound,
final boolean equalsUpper,
final boolean reverse,
final int limit) throws DataAccessLayerException {
final byte[] s = _dictionary.getID(query[0], false);
final byte[] p = _dictionary.getID(query[1], true);
final boolean subjectIsVariable = isVariable(s);

final BoundStatement statement = _rangeQueries[getRangeQueryIndex(reverse, subjectIsVariable, false, !equalsUpper, !equalsLower)].bind();
int queryParameterIndex = 0;
if (!subjectIsVariable) {
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(s));
}
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(p));
statement.setDouble(queryParameterIndex++, lowerBound);
statement.setDouble(queryParameterIndex++, upperBound);
statement.setInt(queryParameterIndex, limit);
return new SPOCResultIterator(_session.executeAsync(statement), false);
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public Iterator numericRangeQuery(
final Value[] query,
final double lowerBound,
final boolean equalsLower,
final double upperBound,
final boolean equalsUpper,
final boolean reverse,
final int limit) throws DataAccessLayerException {

final byte[] s = _dictionary.getID(query[0], false);
final byte[] p = _dictionary.getID(query[1], true);
final boolean subjectIsVariable = isVariable(s);
final BoundStatement statement = _rangeQueries[getRangeQueryIndex(reverse, subjectIsVariable, true, !equalsUpper, !equalsLower)].bind();
int queryParameterIndex = 0;
if (!subjectIsVariable) {
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(s));
}
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(p));
statement.setDouble(queryParameterIndex++, lowerBound);
statement.setDouble(queryParameterIndex++, upperBound);
statement.setInt(queryParameterIndex, limit);
return new SPOCResultIterator(_session.executeAsync(statement), false);
}

代码示例来源:origin: cumulusrdf/cumulusrdf

@Override
public Iterator numericRangeQuery(
final Value[] query,
final double lowerBound,
final boolean equalsLower,
final double upperBound,
final boolean equalsUpper,
final boolean reverse,
final int limit) throws DataAccessLayerException {

final byte[] s = _dictionary.getID(query[0], false);
final byte[] p = _dictionary.getID(query[1], true);
final boolean subjectIsVariable = isVariable(s);
final BoundStatement statement = _rangeQueries[getRangeQueryIndex(reverse, subjectIsVariable, true, !equalsUpper, !equalsLower)].bind();
int queryParameterIndex = 0;
if (!subjectIsVariable) {
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(s));
}
statement.setBytesUnsafe(queryParameterIndex++, ID_SERIALIZER.serialize(p));
statement.setDouble(queryParameterIndex++, lowerBound);
statement.setDouble(queryParameterIndex++, upperBound);
statement.setInt(queryParameterIndex, limit);
return new SPOCResultIterator(_session.executeAsync(statement), false);
}

代码示例来源:origin: com.github.ddth/ddth-cql-utils

bstm.setDecimal(i, (BigDecimal) value);
} else if (value instanceof Double) {
bstm.setDouble(i, ((Double) value).doubleValue());
} else if (value instanceof Float) {
bstm.setFloat(i, ((Float) value).floatValue());

代码示例来源:origin: com.datastax.dse/dse-java-driver-core

@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);
}

推荐阅读
author-avatar
housyou晶
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有