DBIx::SQLEngine::RecordSet::Set - Array of Record Objects
use DBIx::SQLEngine::RecordSet::Set; $record_set = DBIx::SQLEngine::RecordSet::Set->new( @records ); $record_set = $record_class->fetch_select( criteria => { status => 2 } ); print "Found " . $record_set->count() . " records"; $record_set->filter( { 'status' => 'New' } ); $record_set->sort( 'creation_date' ); foreach ( 0 .. $record_set->count() ) { print $record_set->record( $_ )->name(); } foreach ( $record_set->range_records( 11, 20 ) ) { print $_->name(); }
This package is not yet complete.
The base implementation of RecordSet is an array of Record references.
$class->new ( @records ) : $recordset
Array constructor.
$recordset->clone() : $recordset
Create a shallow copy of the record set.
$recordset->init ( @records )
Array content setter.
$rs->records() : @records
Array content accessor.
$count = $rs->count();
Returns the number of records in this set.
$record = $rs->record( $position );
Return the record in the indicated position in the array. Returns nothing if position is undefined.
Indexes start with zero. Negative indexes are counted back from the end, with -1 being the last, -2 being the one before that, and so forth.
$record = $rs->last_record();
Return the last record in the array.
$clone = $rs->range_set( $start_pos, $stop_pos );
Return a copy of the current set containing only those records at or between the start and stop positions.
@records = $rs->range_records( $start_pos, $stop_pos );
Return the records at or between the start and stop positions.
Use of these methods requires the Data::Sorting module from CPAN.
See Data::Sorting for more information.
$rs->sort( @fieldnames );
Sort the contents of the set.
$clone = $rs->sorted_set( @fieldnames );
Return a sorted copy of the current set.
@records = $rs->sorted_records( @fieldnames );
Return the records from the current set, in sorted order.
Caution: This set of methods is currently not working.
$rs->filter( $criteria );
Remove non-matching records from the set.
$clone = $rs->filtered_set( $criteria );
Return a set containing only the matching records from the current set.
@records = $rs->filtered_records( $criteria );
Return the matching records from the current set.
See DBIx::SQLEngine for the overall interface and developer documentation.
See DBIx::SQLEngine::Docs::ReadMe for general information about this distribution, including installation and license information.
To install DBIx::SQLEngine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::SQLEngine
CPAN shell
perl -MCPAN -e shell install DBIx::SQLEngine
For more information on module installation, please visit the detailed CPAN module installation guide.