热门标签 | 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);
}

推荐阅读
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了Java高并发程序设计中线程安全的概念与synchronized关键字的使用。通过一个计数器的例子,演示了多线程同时对变量进行累加操作时可能出现的问题。最终值会小于预期的原因是因为两个线程同时对变量进行写入时,其中一个线程的结果会覆盖另一个线程的结果。为了解决这个问题,可以使用synchronized关键字来保证线程安全。 ... [详细]
  • 本文详细介绍了Java中vector的使用方法和相关知识,包括vector类的功能、构造方法和使用注意事项。通过使用vector类,可以方便地实现动态数组的功能,并且可以随意插入不同类型的对象,进行查找、插入和删除操作。这篇文章对于需要频繁进行查找、插入和删除操作的情况下,使用vector类是一个很好的选择。 ... [详细]
  • 标题: ... [详细]
  • ALTERTABLE通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。语法ALTERTABLEtable{[ALTERCOLUMNcolu ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • IB 物理真题解析:比潜热、理想气体的应用
    本文是对2017年IB物理试卷paper 2中一道涉及比潜热、理想气体和功率的大题进行解析。题目涉及液氧蒸发成氧气的过程,讲解了液氧和氧气分子的结构以及蒸发后分子之间的作用力变化。同时,文章也给出了解题技巧,建议根据得分点的数量来合理分配答题时间。最后,文章提供了答案解析,标注了每个得分点的位置。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 推荐系统遇上深度学习(十七)详解推荐系统中的常用评测指标
    原创:石晓文小小挖掘机2018-06-18笔者是一个痴迷于挖掘数据中的价值的学习人,希望在平日的工作学习中,挖掘数据的价值, ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • Tomcat/Jetty为何选择扩展线程池而不是使用JDK原生线程池?
    本文探讨了Tomcat和Jetty选择扩展线程池而不是使用JDK原生线程池的原因。通过比较IO密集型任务和CPU密集型任务的特点,解释了为何Tomcat和Jetty需要扩展线程池来提高并发度和任务处理速度。同时,介绍了JDK原生线程池的工作流程。 ... [详细]
  • 本文介绍了游标的使用方法,并以一个水果供应商数据库为例进行了说明。首先创建了一个名为fruits的表,包含了水果的id、供应商id、名称和价格等字段。然后使用游标查询了水果的名称和价格,并将结果输出。最后对游标进行了关闭操作。通过本文可以了解到游标在数据库操作中的应用。 ... [详细]
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社区 版权所有