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

推荐阅读
  • 本文详细介绍了在ASP.NET中获取插入记录的ID的几种方法,包括使用SCOPE_IDENTITY()和IDENT_CURRENT()函数,以及通过ExecuteReader方法执行SQL语句获取ID的步骤。同时,还提供了使用这些方法的示例代码和注意事项。对于需要获取表中最后一个插入操作所产生的ID或马上使用刚插入的新记录ID的开发者来说,本文提供了一些有用的技巧和建议。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 标题: ... [详细]
  • ALTERTABLE通过更改、添加、除去列和约束,或者通过启用或禁用约束和触发器来更改表的定义。语法ALTERTABLEtable{[ALTERCOLUMNcolu ... [详细]
  • 本文介绍了iOS数据库Sqlite的SQL语句分类和常见约束关键字。SQL语句分为DDL、DML和DQL三种类型,其中DDL语句用于定义、删除和修改数据表,关键字包括create、drop和alter。常见约束关键字包括if not exists、if exists、primary key、autoincrement、not null和default。此外,还介绍了常见的数据库数据类型,包括integer、text和real。 ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • 在Oracle11g以前版本中的的DataGuard物理备用数据库,可以以只读的方式打开数据库,但此时MediaRecovery利用日志进行数据同步的过 ... [详细]
  • 本文介绍了在使用Laravel和sqlsrv连接到SQL Server 2016时,如何在插入查询中使用输出子句,并返回所需的值。同时讨论了使用CreatedOn字段返回最近创建的行的解决方法以及使用Eloquent模型创建后,值正确插入数据库但没有返回uniqueidentifier字段的问题。最后给出了一个示例代码。 ... [详细]
  • 本文整理了Java中com.evernote.android.job.JobRequest.getTransientExtras()方法的一些代码示例,展示了 ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • Java学习笔记之使用反射+泛型构建通用DAO
    本文介绍了使用反射和泛型构建通用DAO的方法,通过减少代码冗余度来提高开发效率。通过示例说明了如何使用反射和泛型来实现对不同表的相同操作,从而避免重复编写相似的代码。该方法可以在Java学习中起到较大的帮助作用。 ... [详细]
  • 合并列值-合并为一列问题需求:createtabletab(Aint,Bint,Cint)inserttabselect1,2,3unionallsel ... [详细]
  • 本文整理了Java中java.lang.NoSuchMethodError.getMessage()方法的一些代码示例,展示了NoSuchMethodErr ... [详细]
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社区 版权所有