Alzabo::Runtime::Row - Row objects
use Alzabo::Runtime::Row; ... or ... use Alzabo::Runtime::Row qw(MyCaching::Class);
These objects represent actual rows from the database containing actual data. They can be created via their new method or via an Alzabo::Runtime::Table object.
This module attempts to use the Alzabo::ObjectCache module if it has already been loaded when a new row is created. It will use the cache to store objects after they are created as well as using it check object expiration and deletion.
Alzabo::ObjectCache
In addition, using the cache allows the object to cache the results of column fetches. This is an additional performance gain.
table => Alzabo::Runtime::Table object
Alzabo::Runtime::Table
id => (see below)
no_cache => 0 or 1
The id parameter may be one of two things. If the table has only a single column primary key, it can be a simple scalar with the value of that primary key for this row.
id
If the primary key is more than one column than it must be a hash reference containing column names and values such as:
{ pk_column1 => 1, pk_column2 => 'foo' }
Setting the no_cache parameter to true causes this particular row object to not interact with the cache at all. This can be useful if you know you will be creating a very large number of row objects all at once that you have no intention of re-using.
no_cache
If your cache class attempts to synchronize itself across multiple processes (such as Alzabo::ObjectCacheIPC does), then it is highly recommended that you not do any operations that change data in the database (delete or update) with objects that were created with this parameter as it will probably cause problems.
Alzabo::ObjectCacheIPC
A new Alzabo::Runtiem::Row object. It will attempt to retrieve the row from the cache first unless the no_cache parameter is true. If no object matches these values then an exception will be thrown.
Alzabo::Runtiem::Row
Alzabo::Exception::NoSuchRow
Tells the row object to connect to the database and fetch the data for the row matching this row's primary key values. If a cache class is specified it attempts to fetch the data from the cache first.
Returns a list of values matching the specified columns in a list context. In scalar context it returns only a single value (the first column specified).
Given a hash of columns and values, attempts to update the database to and the object to represent these new values.
Deletes the row from the RDBMS and the cache, if it exists.
Returns the row's id value as a string. This can be passed to the Alzabo::Runtime::Table->row_by_id method to recreate the row later.
Alzabo::Runtime::Table->row_by_id
Returns the Alzabo::Runtime::Table object that this row belongs to.
foreign_key => Alzabo::Runtime::ForeignKey object
Alzabo::Runtime::ForeignKey
Given a foreign key object, this method returns a Alzabo::Runtime::RowCursor object for the rows in the table that the relationship is _to_, based on the value of the relevant column in the current row.
Alzabo::Runtime::RowCursor
All other parameters given will be passed directly to the new method (such as the no_cache paremeter).
new
Dave Rolsky, <autarch@urth.org>
To install Alzabo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Alzabo
CPAN shell
perl -MCPAN -e shell install Alzabo
For more information on module installation, please visit the detailed CPAN module installation guide.