Alzabo (version 0.64) - Alzabo::Runtime::PotentialRow

Index



NAME

Alzabo::Runtime::PotentialRow - Row objects that aren't yet in the database


SYNOPSIS

  my $row = $table->potential_row;
  my $other = $table->potential_row( values => { name => 'Ralph' } );
  $row->make_live;  # $row is now a _real_ row object!


DESCRIPTION

These objects represent potential rows, rows which do not yet exist in the database. These are created via the Alzabo::Runtime::Table->potential_row method.

These objects do not interact with the caching system.

They are useful when you need a placeholder object which you can update and select from, but you don't actually want to commit the data to the database.

Once make_live is called, the object is tranformed into a row of the appropriate class.

When a new object of this class is created, it checks for defaults for each column and uses them for its value if no other value is provided by the user.

Potential rows have looser constraints for column values than regular rows. When creating a new potential row, it is ok if none of the columns are defined. However, you cannot update a column in a potential row to NULL if the column is not nullable.


METHODS

For most methods, this object works exactly like an Alzabo::Runtime::Row object. However, this object cannot be deleted, nor does it have an id.

In addition, no attempt is made to enforce referential integrity constraints on this object.

select

select_hash

update

table

rows_by_foreign_key

These methods all operate as they do for Alzabo::Runtime::Row objects.

delete

This method throws an exception as it is not meaningful to try to delete a row that does not exist in the database.

id

This method returns an empty string. Since primary keys may not be known til an insert, in the case of sequenced columns, there is no way to calculate an id.

make_live

This method inserts the row into the database and tranforms the row object, in place, into a row of the appropriate class.

This means that all references to the potential row object will now be references to the real object (which is a good thing).

This method can take any parameters that can be passed to the Alzabo::Runtime::Table->insert method, such as no_cache.

Any columns already set will be passed to the insert method, including primary key values. However, these will be overriddenn, on a column by column basis, by a pk or values parameters given to the make_live method.


AUTHOR

Dave Rolsky, <autarch@urth.org>