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


Java Row.getString方法代码示例

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


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

示例1: queryByOpId

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Override
public List<E> queryByOpId(String opId) throws EventStoreException {
    Select select = QueryBuilder.select(CassandraEventRecorder.ENTITY_ID).from(tableName);
    select.where(QueryBuilder.eq(CassandraEventRecorder.OP_ID, opId));
    List<Row> entityEventDatas = cassandraSession.execute(select, PagingIterable::all);

    Map<String, E> resultList = new HashMap<>();
    for (Row entityEvent : entityEventDatas) {
        String entityId = entityEvent.getString(CassandraEventRecorder.ENTITY_ID);
        if (!resultList.containsKey(entityId)) {
            E value = queryEntity(entityId);
            if (value != null)
                resultList.put(entityId, value);
        }
    }
    return new ArrayList<>(resultList.values());
}
 
开发者ID:kloiasoft,项目名称:eventapis,代码行数:18,代码来源:CassandraViewQuery.java

示例2: getValueGroupChange

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
private Set<ValueGroupChange> getValueGroupChange(final Row row) {
    final String type = row.getString("vgchangetype");
    if (type != null && Type.valueOf(type) != Type.NONE) {
        final ValueGroup group =
                new ValueGroup(row.getUUID("vgid"), row.getString("vgname"),
                        row.getList("vgdrivers", String.class),
                        new DateRange(row.get("vgstart", Instant.class), row.get("vgend", Instant.class)));

        final String driver = row.getString("vgdrivername");
        if (driver != null && !driver.isEmpty()) {
            group.setNewRuleData(driver, row.getList("vgrulecodes", UUID.class));
        }

        return Collections.singleton(new ValueGroupChange(Type.valueOf(type), group));
    }

    return Collections.emptySet();
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:19,代码来源:CassandraLoader.java

示例3: getColValue

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
public Object getColValue(Row row, String colName, DataType colType){	
	switch(colType.getName()){
	case VARCHAR: 
		return row.getString(colName);
	case UUID: 
		return row.getUUID(colName);
	case VARINT: 
		return row.getVarint(colName);
	case BIGINT: 
		return row.getLong(colName);
	case INT: 
		return row.getInt(colName);
	case FLOAT: 
		return row.getFloat(colName);	
	case DOUBLE: 
		return row.getDouble(colName);
	case BOOLEAN: 
		return row.getBool(colName);
	case MAP: 
		return row.getMap(colName, String.class, String.class);
	default: 
		return null;
	}
}
 
开发者ID:att,项目名称:music,代码行数:25,代码来源:MusicDataStore.java

示例4: testQueryPrimeSimple

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Test
public void testQueryPrimeSimple() throws Exception {
  RequestPrime prime = HttpTestUtil.createSimplePrimedQuery("Select * FROM TABLE2");
  HttpTestResponse response = server.prime(prime);
  assertNotNull(response);
  RequestPrime responseQuery = om.readValue(response.body, RequestPrime.class);
  assertThat(responseQuery).isEqualTo(prime);

  String contactPoint = HttpTestUtil.getContactPointString(server.getCluster(), 0);
  ResultSet set = HttpTestUtil.makeNativeQuery("Select * FROM TABLE2", contactPoint);
  List<Row> results = set.all();
  assertThat(1).isEqualTo(results.size());
  Row row1 = results.get(0);
  String column1 = row1.getString("column1");
  assertThat(column1).isEqualTo("column1");
  Long column2 = row1.getLong("column2");
  assertThat(column2).isEqualTo(new Long(2));
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:19,代码来源:HttpPrimeQueryIntegrationTest.java

示例5: testBoundStatementPositional

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Test
public void testBoundStatementPositional() throws Exception {
  HashMap<String, String> paramTypes = new HashMap<>();
  paramTypes.put("c1", "ascii");
  HashMap<String, Object> params = new HashMap<>();
  params.put("c1", "c1");
  RequestPrime prime =
      HttpTestUtil.createSimpleParameterizedQuery(
          "SELECT table FROM foo WHERE c1=?", params, paramTypes);
  HttpTestResponse response = server.prime(prime);
  assertNotNull(response);
  RequestPrime responseQuery = om.readValue(response.body, RequestPrime.class);
  assertThat(responseQuery).isEqualTo(prime);
  String contactPoint = HttpTestUtil.getContactPointString(server.getCluster(), 0);
  ResultSet set =
      HttpTestUtil.makeNativeBoundQueryWithPositionalParam(
          "SELECT table FROM foo WHERE c1=?", contactPoint, "c1");
  List<Row> results = set.all();
  assertThat(1).isEqualTo(results.size());
  Row row1 = results.get(0);
  String column1 = row1.getString("column1");
  assertThat(column1).isEqualTo("column1");
  Long column2 = row1.getLong("column2");
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:25,代码来源:HttpPrimeQueryIntegrationTest.java

示例6: convertToEntityEvent

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
static EntityEvent convertToEntityEvent(Row entityEventData) {
        EventKey eventKey = new EventKey(entityEventData.getString(CassandraEventRecorder.ENTITY_ID), entityEventData.getInt(CassandraEventRecorder.VERSION));
        String opId = entityEventData.getString(CassandraEventRecorder.OP_ID);
        String eventData = entityEventData.getString(CassandraEventRecorder.EVENT_DATA);
//            ObjectNode jsonNode = (ObjectNode) objectMapper.readTree(eventData);
/*            for (String indexedField : indexedFields) {
                if (entityEventData.getColumnDefinitions().contains(indexedField))
                    jsonNode.put(indexedField, entityEventData.getString(indexedField));
            }*/
        return new EntityEvent(eventKey, opId,
                entityEventData.getTimestamp(CassandraEventRecorder.OP_DATE),
                entityEventData.getString(CassandraEventRecorder.EVENT_TYPE),
                EventState.valueOf(entityEventData.getString(CassandraEventRecorder.STATUS)),
                entityEventData.getString(CassandraEventRecorder.AUDIT_INFO),
                eventData);
    }
 
开发者ID:kloiasoft,项目名称:eventapis,代码行数:17,代码来源:CassandraViewQuery.java

示例7: queryTables

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
/**
 * 描述: 查询数据库表名[未实现]
 * 时间: 2017年11月15日 上午11:29:59
 * @author yi.zhang
 * @return 返回表
 */
@Deprecated
public List<String> queryTables(){
	try {
		List<String> tables = new ArrayList<String>();
		String useQuery = "describe tables";
		ResultSet rs = session.execute(useQuery);
		for (Row row : rs.all()) {
			String table = row.getString(1);
			tables.add(table);
		}
		return tables;
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:dev-share,项目名称:database-transform-tool,代码行数:24,代码来源:CassandraFactory.java

示例8: getRuleChangeForChange

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
private Set<RuleChange> getRuleChangeForChange(final Row row) {
    final String type = row.getString("rulechangetype");
    if (type != null && Type.valueOf(type) != Type.NONE) {
        final Builder<RuleBuilder, DecisionTreeRule> ruleBuilder = RuleBuilder.creator()
                .with(RuleBuilder::input, row.getList("ruledrivers", String.class))
                .with(RuleBuilder::output, row.getList("ruleoutputs", String.class))
                .with(RuleBuilder::setId, row.getUUID("ruleid"))
                .with(RuleBuilder::setCode, row.getUUID("rulecode"))
                .with(RuleBuilder::start, row.get("rulestart", Instant.class))
                .with(RuleBuilder::end, row.get("ruleend", Instant.class));

        final DecisionTreeRule rule = ruleBuilder.build();
        return Collections.singleton(new RuleChange(Type.valueOf(type), rule));
    }

    return Collections.emptySet();
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:18,代码来源:CassandraLoader.java

示例9: load

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Override
public Data load(Data data, Row row) {
	data.id = row.getUUID(0);
	data.ticket = row.getUUID(1);
	data.user = row.getString(2);
	data.approver = row.getString(3);
	data.type = row.getString(4);
	data.status = row.getString(5);
	data.memo = row.getString(6);
	data.operation = row.getString(7);
	if(row.getColumnDefinitions().size()>8) {
		// Rows reported in MicroSeconds
		data.updated = new Date(row.getLong(8)/1000);
	}
	return data;
}
 
开发者ID:att,项目名称:AAF,代码行数:17,代码来源:ApprovalDAO.java

示例10: testQueryPositionalParamSimple

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Test
public void testQueryPositionalParamSimple() throws Exception {
  HashMap<String, String> paramTypes = new HashMap<>();
  paramTypes.put("c1", "ascii");
  HashMap<String, Object> params = new HashMap<>();
  params.put("c1", "c1");
  RequestPrime prime =
      HttpTestUtil.createSimpleParameterizedQuery(
          "SELECT table FROM foo WHERE c1=?", params, paramTypes);
  HttpTestResponse response = server.prime(prime);
  assertNotNull(response);
  RequestPrime responseQuery = om.readValue(response.body, RequestPrime.class);
  assertThat(responseQuery).isEqualTo(prime);
  String contactPoint = HttpTestUtil.getContactPointString(server.getCluster(), 0);
  ResultSet set =
      HttpTestUtil.makeNativeQueryWithPositionalParams(
          "SELECT table FROM foo WHERE c1=?", contactPoint, "c1");
  List<Row> results = set.all();
  assertThat(1).isEqualTo(results.size());
  Row row1 = results.get(0);
  String column1 = row1.getString("column1");
  assertThat(column1).isEqualTo("column1");
  Long column2 = row1.getLong("column2");
  // Extra Param
  set =
      HttpTestUtil.makeNativeQueryWithPositionalParams(
          "SELECT table FROM foo WHERE c1=?", contactPoint, "c1", "extraParam");
  assertThat(set.all().size()).isEqualTo(0);
  // Wrong Param
  set =
      HttpTestUtil.makeNativeQueryWithPositionalParams(
          "SELECT table FROM foo WHERE ci1=?", contactPoint, "d1");
  assertThat(set.all().size()).isEqualTo(0);
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:35,代码来源:HttpPrimeQueryIntegrationTest.java

示例11: testBoundStatementNamed

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Test
public void testBoundStatementNamed() throws Exception {
  HashMap<String, String> paramTypes = new HashMap<>();
  paramTypes.put("id", "bigint");
  paramTypes.put("id2", "bigint");
  HashMap<String, Object> params = new HashMap<>();
  params.put("id", new Long(1));
  params.put("id2", new Long(2));
  RequestPrime prime =
      HttpTestUtil.createSimpleParameterizedQuery(
          "SELECT * FROM users WHERE id = :id and id2 = :id2", params, paramTypes);

  HttpTestResponse response = server.prime(prime);
  assertNotNull(response);
  RequestPrime responseQuery = (RequestPrime) om.readValue(response.body, RequestPrime.class);
  assertThat(responseQuery).isEqualTo(prime);
  Map<String, Long> values = ImmutableMap.<String, Long>of("id", new Long(1), "id2", new Long(2));
  String contactPoint = HttpTestUtil.getContactPointString(server.getCluster(), 0);
  ResultSet set =
      HttpTestUtil.makeNativeBoundQueryWithNameParams(
          "SELECT * FROM users WHERE id = :id and id2 = :id2", contactPoint, values);
  List<Row> results = set.all();
  assertThat(1).isEqualTo(results.size());
  Row row1 = results.get(0);
  String column1 = row1.getString("column1");
  assertThat(column1).isEqualTo("column1");
  Long column2 = row1.getLong("column2");
  assertThat(column2).isEqualTo(new Long(2));
  Map<String, String> values2 = ImmutableMap.<String, String>of("id", "1", "id2", "2");
}
 
开发者ID:datastax,项目名称:simulacron,代码行数:31,代码来源:HttpPrimeQueryIntegrationTest.java

示例12: getKeyById

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
/**
 * Get entity key by entity id.
 *
 * @param entityId entity id
 * @param tenant   tenant name
 * @return entity key
 */
public String getKeyById(Long entityId, String tenant) {
    Select select = QueryBuilder.select(ENTITY_KEY_COL).from(tenant, VIEW_ID_KEY);
    select.where(eq(ENTITY_ID_COL, entityId));
    ResultSet resultSet = session.execute(select);
    Row row = resultSet.one();
    return row == null ? null : row.getString(ENTITY_KEY_COL);
}
 
开发者ID:xm-online,项目名称:xm-ms-timeline,代码行数:15,代码来源:EntityMappingRepository.java

示例13: getChange

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
public Result<ChangeSet> getChange(final String changeSetName) {
    try {
        final ResultSet resultSet = this.session.execute(CQL_GET_ACTIVE_CHANGE, changeSetName);
        EhSupport.ensure(!resultSet.isExhausted(), "ChangeSet %s does not exist in %s.", changeSetName,
                this.keyspace);
        UUID changeSetId = null;
        final Map<Change, List<Change>> changes = new HashMap<>();

        for (final Row row : resultSet) {
            changeSetId = row.getUUID("id");

            final UUID changeid = row.getUUID("changeid");
            final String rulesetname = row.getString("rulesetname");
            final Instant activationTime = row.get("activationtime", Instant.class);
            final DateRange changeRange = new DateRange(row.get("start", Instant.class),
                    row.get("end", Instant.class));
            final Change newchange = new Change(changeid, rulesetname, activationTime, changeRange,
                    getAuditForChange(row), getRuleChangeForChange(row), getValueGroupChange(row));

            final List<Change> internalChanges = changes.computeIfAbsent(newchange, value -> new ArrayList<>());
            internalChanges.add(newchange);
        }
        return Result.success(new ChangeSet(changeSetId, changeSetName, mergeChangesIntoSet(changes)));
    } catch (final Exception exception) {
        return Result.failure(() -> exception);
    }
}
 
开发者ID:jpmorganchase,项目名称:swblocks-decisiontree,代码行数:28,代码来源:CassandraLoader.java

示例14: getStringValue

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
private String getStringValue(Row row) {
    if (aggregation == Aggregation.MIN || aggregation == Aggregation.MAX) {
        return row.getString(STR_POS);
    } else {
        return null;
    }
}
 
开发者ID:osswangxining,项目名称:iotplatform,代码行数:8,代码来源:AggregatePartitionsFunction.java

示例15: processRow

import com.datastax.driver.core.Row; //导入方法依赖的package包/类
@Override
public void processRow(Row row) throws DriverException {
    String aggregateType = row.getString(AGGREGATE_TYPE);
    String name = row.getString(EVENT_NAME);
    String version = row.getString(EVENT_VERSION);

    VersionedName versionedName = VersionedName.of(name, version);
    EventType eventType = EventType.of(aggregateType, versionedName);

    matcher.match(eventType).ifPresent(tupleSchema -> {
        createEvent(row, aggregateType, versionedName, tupleSchema);
    });
}
 
开发者ID:opencredo,项目名称:concursus,代码行数:14,代码来源:EventTranslator.java


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