当前位置: 首页>>代码示例>>Java>>正文


Java Update.Where方法代码示例

本文整理汇总了Java中com.datastax.driver.core.querybuilder.Update.Where方法的典型用法代码示例。如果您正苦于以下问题:Java Update.Where方法的具体用法?Java Update.Where怎么用?Java Update.Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.querybuilder.Update的用法示例。


在下文中一共展示了Update.Where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRequestMessageStatement

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
/**
 * Test with incoming message containing a header with RegularStatement.
 */
@Test
public void testRequestMessageStatement() throws Exception {
    Update.Where update = update("camel_user")
            .with(set("first_name", bindMarker()))
            .and(set("last_name", bindMarker()))
            .where(eq("login", bindMarker()));
    Object response = producerTemplate.requestBodyAndHeader(new Object[]{"Claus 2", "Ibsen 2", "c_ibsen"},
            CassandraConstants.CQL_QUERY, update);

    Cluster cluster = CassandraUnitUtils.cassandraCluster();
    Session session = cluster.connect(CassandraUnitUtils.KEYSPACE);
    ResultSet resultSet = session.execute("select login, first_name, last_name from camel_user where login = ?", "c_ibsen");
    Row row = resultSet.one();
    assertNotNull(row);
    assertEquals("Claus 2", row.getString("first_name"));
    assertEquals("Ibsen 2", row.getString("last_name"));
    session.close();
    cluster.close();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:CassandraComponentProducerTest.java

示例2: testRequestMessageStatement

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
/**
 * Test with incoming message containing a header with RegularStatement.
 */
@Test
public void testRequestMessageStatement() throws Exception {
    Update.Where update = update("camel_user")
            .with(set("first_name", "Claus 2"))
            .and(set("last_name", "Ibsen 2"))
            .where(eq("login", "c_ibsen"));
    Object response = producerTemplate.requestBodyAndHeader(null,
            CassandraConstants.CQL_QUERY, update);

    Cluster cluster = CassandraUnitUtils.cassandraCluster();
    Session session = cluster.connect(CassandraUnitUtils.KEYSPACE);
    ResultSet resultSet = session.execute("select login, first_name, last_name from camel_user where login = ?", "c_ibsen");
    Row row = resultSet.one();
    assertNotNull(row);
    assertEquals("Claus 2", row.getString("first_name"));
    assertEquals("Ibsen 2", row.getString("last_name"));
    session.close();
    cluster.close();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:CassandraComponentProducerUnpreparedTest.java

示例3: updateCornerEvents

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
private RegularStatement updateCornerEvents(Identifier accId, String analyseId, String jvmId,
                                           DateTime firstEvent, DateTime lastEvent) {
    RegularStatement ule = updateTable(accId, analyseId)
            .with(put("last_event", jvmId, lastEvent.toDateTime(DateTimeZone.UTC).getMillis()));
    if (firstEvent != null) {
        Update.Where firstEventQuery = updateTable(accId, analyseId);
        firstEventQuery
                .with(put("first_event", jvmId, firstEvent.toDateTime(DateTimeZone.UTC).getMillis()));
        firstEventQuery.onlyIf(eq("first_event['" + jvmId + "']", null));
        connector.session().execute(firstEventQuery);
    }
    return ule;
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:14,代码来源:CassandraGCAnalyseRepository.java

示例4: testEndpointNoCqlParameter

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
/**
 * Simulate different CQL statements in the incoming message containing a header with RegularStatement, justifying the cassandracql endpoint not containing a "cql" Uri parameter
 */
@Test
public void testEndpointNoCqlParameter() throws Exception {
    Update.Where updateFirstName = update("camel_user")
            .with(set("first_name", bindMarker()))
            .where(eq("login", bindMarker()));
    @SuppressWarnings("unused")
    Object response1 = producerTemplateNoEndpointCql.requestBodyAndHeader(new Object[]{"Claus 2", "c_ibsen"},
            CassandraConstants.CQL_QUERY, updateFirstName);

    Cluster cluster = CassandraUnitUtils.cassandraCluster();
    Session session = cluster.connect(CassandraUnitUtils.KEYSPACE);
    ResultSet resultSet1 = session.execute("select login, first_name, last_name from camel_user where login = ?", "c_ibsen");
    Row row1 = resultSet1.one();
    assertNotNull(row1);
    assertEquals("Claus 2", row1.getString("first_name"));
    assertEquals("Ibsen", row1.getString("last_name"));

    Update.Where updateLastName = update("camel_user")
            .with(set("last_name", bindMarker()))
            .where(eq("login", bindMarker()));
    @SuppressWarnings("unused")
    Object response2 = producerTemplateNoEndpointCql.requestBodyAndHeader(new Object[]{"Ibsen 2", "c_ibsen"},
            CassandraConstants.CQL_QUERY, updateLastName);

    ResultSet resultSet2 = session.execute("select login, first_name, last_name from camel_user where login = ?", "c_ibsen");
    Row row2 = resultSet2.one();
    assertNotNull(row2);
    assertEquals("Claus 2", row2.getString("first_name"));
    assertEquals("Ibsen 2", row2.getString("last_name"));

    session.close();
    cluster.close();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:CassandraComponentProducerTest.java

示例5: generateAccessToken

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
@Override
public String generateAccessToken(String externalId, String tenantId) {
  LOG.debug("Generating access token for endpoint user with external id {} and tenant id {}",
      externalId, tenantId);
  String accessToken = UUID.randomUUID().toString();
  Update.Where query = update(getColumnFamilyName())
      .with(set(CassandraModelConstants.EP_USER_ACCESS_TOKEN_PROPERTY, accessToken))
      .where(eq(EP_USER_EXTERNAL_ID_PROPERTY, externalId))
      .and(eq(EP_USER_TENANT_ID_PROPERTY, tenantId));
  execute(query);
  LOG.trace("Generated access token {} for endpoint user by query {}", accessToken, query);
  return accessToken;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:14,代码来源:EndpointUserCassandraDao.java

示例6: updateTable

import com.datastax.driver.core.querybuilder.Update; //导入方法依赖的package包/类
private Update.Where updateTable(Identifier accId, String uuid) {
    return updateTable(accId, UUID.fromString(uuid));
}
 
开发者ID:dmart28,项目名称:gcplot,代码行数:4,代码来源:CassandraGCAnalyseRepository.java


注:本文中的com.datastax.driver.core.querybuilder.Update.Where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。