|
The data which is returned by a Select or a Search can be accessed
in two ways: 1.) Through an array. Each item of the array corresponds to one of
the selected records. Each array-item is a reference to a hash containing
an entry for every field. Example:
$set[1]{id} access the field 'id' of the second record found
$set[3]{name} access the field 'name' of the fourth record found The record is fetched from the DBD driver when you access it the first time
and is stored by DBIx::Recordset for later access. If you don't access the records
one after each other, the skipped records are not stored and therefore can't be
accessed anymore, unless you specify the !StoreAll parameter. 2.) DBIx::Recordset holds a current record which can be accessed directly via
a hash. The current record is the one you last accessed via the array. After
a Select or Search, it is reset to the first record. You can change the current
record via the methods Next, Prev, First, Add. Example:
$set{id} access the field 'id' of the current record
$set{name} access the field 'name' of the current record Instead of doing a Select or Search you can directly access one row
of a table when you have tied a hash to DBIx::Recordset::Hash or have
specified the !HashAsRowKey Parameter.
The hashkey will work as primary key to the table. You must specify the
!PrimKey as setup parameter. Example:
$set{4}{name} access the field 'name' of the row with primary key = 4
|