Package com.datastax.driver.core

Examples of com.datastax.driver.core.Row


    new ResultSetExtractor<Book>() {

      @Override
      public Book extractData(ResultSet rs) throws DriverException, DataAccessException {
        Row r = rs.one();
        assertNotNull(r);

        Book b = rowToBook(r);

        return b;
View Full Code Here


      }
    }, new ResultSetExtractor<Book>() {

      @Override
      public Book extractData(ResultSet rs) throws DriverException, DataAccessException {
        Row r = rs.one();
        assertNotNull(r);

        Book b = rowToBook(r);

        return b;
View Full Code Here

    }, new ResultSetExtractor<Book>() {

      @Override
      public Book extractData(ResultSet rs) throws DriverException, DataAccessException {
        Book b = new Book();
        Row r = rs.one();
        b.setIsbn(r.getString("isbn"));
        b.setTitle(r.getString("title"));
        b.setAuthor(r.getString("author"));
        b.setPages(r.getInt("pages"));
        return b;
      }
    });

    return b;
View Full Code Here

      final Iterator<Row> it = cassandraResultList.iterator();
      // Iterate over all results and create fresh EventBean for all
      // data results from the database query.
      while (it.hasNext()) {
        final Row cassandraRow = it.next();
        esperResultSet.add(_eventFactory.wrap(rowVisitor
            .visitRow(cassandraRow)));
      }
    } catch (Exception e) {
      if (!_log.isDebugEnabled()) {
View Full Code Here

    final Iterator<Row> it = cassandraResultList.iterator();
    // Iterate over all results and create fresh EventBean for all
    // data results from the database query.
    while (it.hasNext()) {
      final Map<String, Object> resultData = new HashMap<String, Object>();
      final Row cassandraRow = it.next();
      for (String property : _propertyNames) {
        resultData.put(property, cassandraRow.getString(property));
      }
      esperResultSet.add(_eventFactory.wrap(resultData));
    }

    return esperResultSet;
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) {
            throw e;
        } catch (RuntimeException e) {
            throw new 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) {
            throw e;
        } catch (RuntimeException e) {
            throw new BinaryStoreException(e);
        }
View Full Code Here

    @Override
    public InputStream getInputStream( BinaryKey key ) throws BinaryStoreException {
        try {
            ResultSet rs = session.execute("SELECT payload FROM modeshape.binary WHERE cid='" + key.toString() + "'");
            Row row = rs.one();
            if (row == null) {
                throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(key, session));
            }

            ByteBuffer buffer = row.getBytes("payload");
            return new BufferedInputStream(buffer);
        } catch (BinaryStoreException e) {
            throw e;
        } catch (RuntimeException e) {
            throw new BinaryStoreException(e);
View Full Code Here

        BoundStatement select = statements.getLoadFile().bind(id);
        session.executeAsync(select, new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(ResultSet result) {
                Row row = result.one();
                if (row == null) {
                    context.stop();
                    callback.onSuccess(null);
                    return;
                }

                try {
                    DefaultFileInfo fileInfo = new DefaultFileInfo()
                            .setId(id)
                            .setFileName(row.getString("filename"))
                            .setContentType(row.getString("contentType"))
                            .setLength(row.getLong("length"))
                            .setChunkSize(row.getInt("chunkSize"))
                            .setUploadDate(row.getLong("uploadDate"))
                            .setMetadata(row.getMap("metadata", String.class, String.class));

                    context.stop();
                    callback.onSuccess(fileInfo);

                } catch (Throwable t) {
View Full Code Here

        BoundStatement select = statements.getLoadChunk().bind(id, n);
        session.executeAsync(select, new FutureCallback<ResultSet>() {
            @Override
            public void onSuccess(ResultSet result) {
                Row row = result.one();
                if (row == null) {
                    context.stop();
                    callback.onSuccess(null);
                    return;
                }

                try {
                    DefaultChunkInfo chunkInfo = new DefaultChunkInfo()
                            .setId(id)
                            .setNum(n);

                    ByteBuffer bb = row.getBytes("data");
                    byte[] data = new byte[bb.remaining()];
                    bb.get(data);
                    chunkInfo.setData(data);

                    context.stop();
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.Row

Copyright © 2018 www.massapicom. 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.