vendor/gems/right_aws-1.9.0/lib/sdb/right_sdb_interface.rb
# Perform a query on SDB.
# 
# Returns a hash:
#   { :box_usage  => string,
#     :request_id => string,
#     :next_token => string,
#     :items      => [ItemName1,..., ItemNameN] }
#     
# Example:
# 
#   query = "['cat' = 'clew']"
#   sdb.query('family', query)     #=> hash of data
#   sdb.query('family', query, 10) #=> hash of data with max of 10 items
# 
# If a block is given, query will iteratively yield results to it as long as the block continues to return true.
# 
#   # List 10 items per iteration. Don't 
#   # forget to escape single quotes and backslashes and wrap all the items in single quotes.
#   query = "['cat'='clew'] union ['dog'='Jon\\'s boot']"
#   sdb.query('family', query, 10) do |result|
#     puts result.inspect
#     true
#   end
#  
#   # Same query using automatic escaping...to use the auto escape, pass the query and its params as an array:
#   query = [ "['cat'=?] union ['dog'=?]", "clew", "Jon's boot" ]
#   sdb.query('family', query)
#
#   query = [ "['cat'=?] union ['dog'=?] sort 'cat' desc", "clew", "Jon's boot" ]
#   sdb.query('family', query)
#
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_Query.html
#      http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?SortingData.html
#
Perform a query on SDB.





If a block is given, query will iteratively yield results to it as long as the block continues to return true.

List 10 items per iteration. Don't
forget to escape single quotes and backslashes and wrap all the items in single quotes.






Perform a query on SDB . If a block is given query will iteratively yield results to it as long as the block continues to return true . List 10 items per iteration . Don ' t forget to escape single quotes and backslashes and wrap all the items in single quotes .
def query(domain_name, query_expression = nil, max_number_of_items = nil, next_token = nil)
      query_expression = query_expression_from_array(query_expression) if query_expression.is_a?(Array)
      @last_query_expression = query_expression
      request_params = { 'DomainName'       => domain_name,
                         'QueryExpression'  => query_expression,
                         'MaxNumberOfItems' => max_number_of_items,
                         'NextToken'        => next_token }
      link   = generate_request("Query", request_params)
      result = request_info( link, QSdbQueryParser.new )
       return result if no block given
      return result unless block_given?
       loop if block if given
      begin
         the block must return true if it wanna continue 
        break unless yield(result) && result[:next_token]
         make new request
        request_params['NextToken'] = result[:next_token]
        link   = generate_request("Query", request_params)
        result = request_info( link, QSdbQueryParser.new )
      end while true
    rescue Exception
      on_exception
    end
def query ( domain_name , query_expression = nil , max_number_of_items = nil , next_token = nil ) query_expression = query_expression_from_array ( query_expression ) if query_expression . is_a? ( Array ) @last_query_expression = query_expression request_params = { 'DomainName' => domain_name , 'QueryExpression' => query_expression , 'MaxNumberOfItems' => max_number_of_items , 'NextToken' => next_token } link = generate_request ( "Query" , request_params ) result = request_info ( link , QSdbQueryParser . new ) return result unless block_given? begin break unless yield ( result ) && result [ :next_token ] request_params [ 'NextToken' ] = result [ :next_token ] link = generate_request ( "Query" , request_params ) result = request_info ( link , QSdbQueryParser . new ) end while true rescue Exception on_exception end
Perform a query on SDB.
Perform a query on SDB .
# # return result if no block given # loop if block if given # the block must return true if it wanna continue  # make new request
domain_name
<not_specific>
query_expression
<not_specific>
max_number_of_items
<not_specific>
next_token
<not_specific>