Package com.amazonaws.services.simpledb.model

Examples of com.amazonaws.services.simpledb.model.SelectRequest


     * Returns the number of messages served from the given start timestamp to
     * the end timestamp.
     **/
    public long getThroughput(Date start, Date end) {

        SelectRequest request = new SelectRequest("select count(*) "
                + "from sqs_log " + "where SentTimestamp > '"
                + format.format(start) + "' " + "and ProcessedTimestamp < '"
                + format.format(end) + "'");

        SelectResult result = simpleDB.select(request);
View Full Code Here


        super();
        this.service = service;
    }

    public boolean execute(DumpDomainContext context) throws Exception {
        SelectRequest selectRequest = new SelectRequest(String.format("SELECT * FROM %s", context.getDomain()));
        SelectResult selectResult = service.select(selectRequest);

        ArrayNode rootNode = mapper.createArrayNode();

        while (!selectResult.getItems().isEmpty()) {
            for (Item item : selectResult.getItems())
                appendResult(rootNode, item);
                   
            if (isBlank(selectResult.getNextToken()))
                break;

            selectResult = service.select(selectRequest.withNextToken(selectResult.getNextToken()));
        }
       
        FileWriter writer = new FileWriter(context.getOutputFile());
       
        writeData(rootNode, writer);
View Full Code Here

    public static List<Item> listAllItems(AmazonSimpleDB db, String domainName, boolean consistentRead) throws AmazonClientException {
        SelectResult results = new SelectResult();

        List<Item> items = new ArrayList<Item>();
        do {
            results = db.select(new SelectRequest()
                .withConsistentRead(consistentRead)
                .withSelectExpression("select * from `" + domainName + "`")
                .withNextToken(results.getNextToken()));
           
            items.addAll(results.getItems());
View Full Code Here

     * @return
     * @throws AmazonClientException
     */
    public static SelectResult selectItems(AmazonSimpleDB db, String query, String nextToken, boolean consistentRead) throws AmazonClientException {

        SelectResult results = db.select(new SelectRequest()
            .withConsistentRead(consistentRead)
            .withSelectExpression(query)   
            .withNextToken(nextToken));        
       
        return results;
View Full Code Here

        if(whereClause != null) {
            selectExpression += " where " + whereClause;
        }

       
        SelectResult results = db.select(new SelectRequest()
            .withConsistentRead(consistentRead)
            .withSelectExpression(selectExpression)    
            .withNextToken(nextToken));        
       
        return results;
View Full Code Here

            log.info("after replacing ?'s, new sql is : " + this.sql);
           
            String origDomain = ((PlainSelect) select.getSelectBody()).getFromItem().toString();
            String domain =((PlainSelect) select.getSelectBody()).getFromItem().toString();
            sql = sql.replaceAll(origDomain, SimpleDBUtils.quoteName(domain));
            SelectRequest selectRequest = new SelectRequest(sql);
            List<Item> items = this.connection.getSimpleDB().select(selectRequest)
                    .getItems();
            return getSimpleDBResultSet(domain, items);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            int argsSize = this.args.size();
            for (int x = 0; x < argsSize; x++) {
                qury = qury.replaceFirst("\\?", SimpleDBUtils.quoteValue(this.args.get(x)));
            }
           
            SelectRequest selectRequest = new SelectRequest(qury);
            List<Item> items = this.connection.getSimpleDB().select(selectRequest).getItems();

            for (Item item : items) {
                req.setItemName(item.getName());
                this.connection.getSimpleDB().deleteAttributes(req);
View Full Code Here

        int argsSize = this.args.size();
        for (int x = sizeSets; x < argsSize; x++) {
            qury = qury.replaceFirst("\\?", SimpleDBUtils.quoteValue(this.args.get(x)));
        }

        SelectRequest selectRequest = new SelectRequest(qury);
        List<Item> items = this.connection.getSimpleDB().select(selectRequest).getItems();
        List<ReplaceableItem> data = new ArrayList<ReplaceableItem>();

        for (Item item : items) {
            List<Column> columns = (List<Column>) update.getColumns();           
View Full Code Here

            // Select data from a domain
            // Notice the use of backticks around the domain name in our select expression.
            String selectExpression = "select * from `" + myDomain + "` where Category = 'Clothes'";
            System.out.println("Selecting: " + selectExpression + "\n");
            SelectRequest selectRequest = new SelectRequest(selectExpression);
            for (Item item : sdb.select(selectRequest).getItems()) {
                System.out.println("  Item");
                System.out.println("    Name: " + item.getName());
                for (Attribute attribute : item.getAttributes()) {
                    System.out.println("      Attribute");
View Full Code Here

  {
    boolean result = false;
        String selectExpression = "select * from `" + myDomain + "` where itemName() = '" + path + "'";

        System.out.println("Selecting: " + selectExpression + "\n");
        SelectRequest selectRequest = new SelectRequest(selectExpression);
        for (Item item : sdb.select(selectRequest).getItems()) {
            System.out.println("  Item");
            System.out.println("    Name: " + item.getName());
            for (Attribute attribute : item.getAttributes()) {
              if(attribute.getName().equals("ReadRevisionNumber"))
View Full Code Here

TOP

Related Classes of com.amazonaws.services.simpledb.model.SelectRequest

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.