Package com.datastax.driver.core

Examples of com.datastax.driver.core.ResultSet.one()


    protected int queryReplicationFactor() {
        int replicationFactor = 1;
        try {
            ResultSet resultSet = execute(
                "SELECT strategy_options FROM system.schema_keyspaces where keyspace_name='rhq'");
            Row row = resultSet.one();

            String replicationFactorString = "replication_factor\"";
            String resultString = row.getString(0);
            resultString = resultString.substring(resultString.indexOf(replicationFactorString)
                + replicationFactorString.length());
View Full Code Here


        DateTime previousHour = current1HourTimeSlice();
        DateTime oldestRawTime = previousHour.minus(Days.days(7));

        ResultSet resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
        Row row = resultSet.one();
        while (row == null && previousHour.compareTo(oldestRawTime) > 0) {
            previousHour = previousHour.minusHours(1);
            resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
            row = resultSet.one();
        }
View Full Code Here

        ResultSet resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
        Row row = resultSet.one();
        while (row == null && previousHour.compareTo(oldestRawTime) > 0) {
            previousHour = previousHour.minusHours(1);
            resultSet = getIndexTimeSlice(Bucket.ONE_HOUR, previousHour);
            row = resultSet.one();
        }

        if (row == null) {
            log.info("No data found in metrics_index table");
            return null;
View Full Code Here

    if (cqlResult == null || cqlResult.isExhausted()) {
      return CqlQueryResult.EMPTY;
    }

    Map<String, CqlColumnType> typeMap = createTypeMap(query);
    Row firstRow = cqlResult.one();
    CqlRowMetadata rowMetadata = extractRowMetadata(firstRow, typeMap);

    RowIterator rowIterator = new RowIterator(cqlResult.iterator(), firstRow);
    CqlQueryResult result = new CqlQueryResult(rowIterator, rowMetadata);
    return result;
View Full Code Here

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Lazy load of {} attributes for {}", attrs.length, type);
        }

        ResultSet resultSet = session.execute(bStmt);
        Row row = resultSet.one();
        if (row != null) {
            Retriever retriever = new GettableRetriever(persistenceSession.persistenceManager.protocolVersion, row, loadColumns);
            for (MappedAttribute attr : attrs) {
                Object instance = resolveParentInstance(container, attr);
                if (LOGGER.isDebugEnabled()) {
View Full Code Here

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Lazy load of {} attributes for {}", attrs.length, type);
        }

        ResultSet resultSet = session.execute(bStmt);
        Row row = resultSet.one();
        if (row != null) {
            Retriever retriever = new GettableRetriever(persistenceSession.persistenceManager.protocolVersion, row, loadColumns);
            for (MappedAttribute attr : attrs) {
                Object instance = resolveParentInstance(container, attr);
                if (LOGGER.isDebugEnabled()) {
View Full Code Here

        @SuppressWarnings("unchecked") @Override public void run() {
            try {
                ResultSet rs = delegate.get();
                if (!rs.isExhausted()) {
                    Row row = rs.one();
                    boolean applied = row.getBool("[applied]");
                    if (!applied) {
                        for (BatchPartFutureImpl future : futures) {
                            future.setException(new CasNotAppliedException(future.entity, future.instance, future.mode, row));
                        }
View Full Code Here

      Future<ResultSet> future = theOneBatch.next();
      ResultSet results = get(future)
      cachedLastCols = new ArrayList<IndexColumn>().listIterator();

      if(!results.isExhausted()) {
          com.datastax.driver.core.Row row = results.one();
          IndexColumn indexCol = Cql3Util.convertToIndexCol(row, indTable);
          cachedLastCols.add(indexCol);
        if(batchListener != null)
          batchListener.afterFetchingNextBatch(10);
        return new Holder<IndexColumn>(indexCol);
View Full Code Here

    @Override
    protected String getStoredMimeType( BinaryValue source ) throws BinaryStoreException {
        try {
            checkContentExists(source);
            ResultSet rs = session.execute("SELECT mime_type FROM modeshape.binary WHERE cid = '" + source.getKey() + "';");
            Row row = rs.one();
            if (row == null) {
                throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(source.getKey(), session));
            }
            return row.getString("mime_type");
        } catch (BinaryStoreException e) {
View Full Code Here

    @Override
    public String getExtractedText( BinaryValue source ) throws BinaryStoreException {
        try {
            checkContentExists(source);
            ResultSet rs = session.execute("SELECT ext_text FROM modeshape.binary WHERE cid = '" + source.getKey() + "';");
            Row row = rs.one();
            if (row == null) {
                throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(source.getKey(), session));
            }
            return row.getString("ext_text");
        } catch (BinaryStoreException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.