Home : Documentation : DBIx::Recordset
Google Web perl.apache.org

 
Home
 
Features
 
Introduction
 
Documentation
 
README
 
README.v2
 
Configuration
 
Embperl
 
Embperl::Object
 
Embperl::Form::Validate
 
Embperl::Syntax
 
Embperl::Recipe
 
Embperl::Mail
 
1.3.6 documentation
 
DBIx::Recordset
 
Installation
 
Download
 
Support
 
Changes
 
Wiki
 
More infos
 
Add info about Embperl
 
Login

    Stable 2.4.0
    Beta 2.5.0_3
Support the development of Embperl! More...
DATA ACCESS
[ << Prev: ARGUMENTS ] [ Content ] [ Next: MODIFYING DATA DIRECTLY >> ]

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


[ << Prev: ARGUMENTS ] [ Content ] [ Next: MODIFYING DATA DIRECTLY >> ]

© 1997-2012 Gerald Richter / ecos gmbh