NAME
SimpleDB::Class::ResultSet - An iterator of items from a domain.
VERSION
version 0.0701
DESCRIPTION
This class is an iterator to walk to the items passed back from a query.
Warning: Once you have a result set and you start calling methods on it, it will begin iterating over the result set. Therefore you can't call both next
and search
, or any other combinations of methods on an existing result set.
Warning: If you call a method like search
on a result set which causes another query to be run, know that the original result set must be very small. This is because there is a limit of 20 comparisons per request as a limitation of SimpleDB.
METHODS
The following methods are available from this class.
new ( params )
Constructor.
params
A hash.
simpledb
Required. A SimpleDB::Class object.
item_class
Required. A SimpleDB::Class::Item subclass name.
result
A result as returned from the send_request() method from SimpleDB::Class::HTTP. Either this or a where is required.
where
A where clause as defined in SimpleDB::Class::SQL. Either this or a result is required.
item_class ( )
Returns the item_class passed into the constructor.
where ( )
Returns the where passed into the constructor.
simpledb ( )
Returns the simpledb passed into the constructor.
result ( )
Returns the result passed into the constructor, or the one generated by fetch_result() if a where is passed into the constructor.
has_result ()
A boolean indicating whether a result was passed into the constructor, or generated by fetch_result().
iterator ( )
Returns an integer which represents the current position in the result set as traversed by next().
fetch_result ( )
Fetches a result, based on a where clause passed into a constructor, and then makes it accessible via the result() method.
count ( [ where ] )
Counts the items in the result set. Returns an integer.
where
A where clause as defined by SimpleDB::Class::SQL. If this is specified, then an additional query is executed before counting the items in the result set.
search ( where )
Just like "search" in SimpleDB::Class::Domain, but searches within the confines of the current result set, and then returns a new result set.
where
A where clause as defined by SimpleDB::Class::SQL.
update ( attributes )
Calls update
and then put
on all the items in the result set.
attributes
A hash reference containing name/value pairs to update in each item.
delete ( )
Calls delete
on all the items in the result set.
next ()
Returns the next result in the result set. Also fetches th next partial result set if there's a next token in the first result set and you've iterated through the first partial set.
LEGAL
SimpleDB::Class is Copyright 2009 Plain Black Corporation (http://www.plainblack.com/) and is licensed under the same terms as Perl itself.