Alzabo::Runtime::Row - Row objects


NAME

Alzabo::Runtime::Row - Row objects


SYNOPSIS

  use Alzabo::Runtime::Row;


DESCRIPTION

These objects represent actual rows from the database containing actual data. In general, you will want to use the Alzabo::Runtime::Table object to retrieve rows. The Alzabo::Runtime::Table can return either single rows or row cursors.


CACHING

If you load the Alzabo::ObjectCache module before loading this one, then row objects will be cached, as will database accesses.


METHODS

select (@list_of_column_names)

Returns

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).

select_hash (@list_of_column_names)

Returns

Returns a hash of column names to values matching the specified columns.

update (%hash_of_columns_and_values)

Given a hash of columns and values, attempts to update the database to and the object to represent these new values.

delete

Deletes the row from the RDBMS and the cache, if it exists.

id

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.

table

Returns the Alzabo::Runtime::Table object that this row belongs to.

rows_by_foreign_key

Parameters

Given a foreign key object, this method returns either an Alzabo::Runtime::Row object or an Alzabo::Runtime::RowCursor object for the row(s) in the table that to which the relationship exists, based on the value of the relevant column(s) in the current row.

The type of object returned is based on the cardinality of the relationship. If the relationship says that there could only be one matching row, then a row object is returned, otherwise it returns a cursor.

All other parameters given will be passed directly to the new method (such as the no_cache paremeter).

new

Parameters

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.

If your cache class synchronizes itself across multiple processes 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.

Returns

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.

Throws

Alzabo::Exception::NoSuchRow


AUTHOR

Dave Rolsky, <autarch@urth.org>

 Alzabo::Runtime::Row - Row objects