當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。