Wednesday, April 17, 2013

Amazon SimpleDB select() example c c++ objc


select:

The Select operation returns a set of attributes for ItemNames that match the select expression. Select is similar to the standard SQL SELECT statement.
The total size of the response cannot exceed 1 MB in total size. Amazon SimpleDB automatically adjusts the number of items returned per page to enforce this limit. For example, if the client asks to retrieve 2500 items, but each individual item is 10 kB in size, the system returns 100 items and an appropriate NextToken so the client can access the next page of results.
For information on how to construct select expressions, see Using Select to Create Amazon SimpleDB Queries in the Developer Guide.
- (SimpleDBSelectResponse *)select:(SimpleDBSelectRequest *)selectRequest

Parameters

selectRequest
Container for the necessary parameters to execute the Select service method on AmazonSimpleDB.

Return Value

The response from the Select service method, as returned by AmazonSimpleDB.

Example


{
    NSString      *expression = @"select * from `domainName` limit 100";
    // Construct request.
    //
    SimpleDBSelectRequest   *selectRequest = [[[SimpleDBSelectRequest alloc] initWithSelectExpression:expression] autorelease];

    [selectRequest setRequestEndpoint:AMAZON_SDB_US_EAST_1_ENDPOINT_SECURE];
    
    // Perform select operation.
    //
    SimpleDBSelectResponse  *selectResponse = [[AmazonClientManager sdb] select:selectRequest];
    if( selectResponse.error != nil )
    {
        NSLog(@"Error: %@", selectResponse.error);
    }
   
    return selectResponse.items;
}