1Rose::DB::Object::IteraUtsoerr(3C)ontributed Perl DocumeRnotsaet:i:oDnB::Object::Iterator(3)
2
3
4
6 Rose::DB::Object::Iterator - Iterate over a series of
7 Rose::DB::Objects.
8
10 $iterator = Rose::DB::Object::Manager->get_objects_iterator(...);
11
12 while($object = $iterator->next)
13 {
14 # do stuff with $object...
15
16 if(...) # bail out early
17 {
18 $iterator->finish;
19 last;
20 }
21 }
22
23 if($iterator->error)
24 {
25 print "There was an error: ", $iterator->error;
26 }
27 else
28 {
29 print "Total: ", $iterator->total;
30 }
31
33 Rose::DB::Object::Iterator is an iterator object that traverses a
34 database query, returning Rose::DB::Object-derived objects for each
35 row. Rose::DB::Object::Iterator objects are created by calls to the
36 get_objects_iterator method of Rose::DB::Object::Manager or one of its
37 subclasses.
38
40 error
41 Returns the text message associated with the last error, or false
42 if there was no error.
43
44 finish
45 Prematurely stop the iteration (i.e., before iterating over all of
46 the available objects).
47
48 next
49 Return the next Rose::DB::Object-derived object. Returns false
50 (but defined) if there are no more objects to iterate over, or
51 undef if there was an error.
52
53 total
54 Returns the total number of objects iterated over so far.
55
57 John C. Siracusa (siracusa@gmail.com)
58
60 Copyright (c) 2010 by John C. Siracusa. All rights reserved. This
61 program is free software; you can redistribute it and/or modify it
62 under the same terms as Perl itself.
63
64
65
66perl v5.32.0 2020-07-28 Rose::DB::Object::Iterator(3)