Alzabo::Runtime::PotentialRow - Row objects that aren't yet in the database
my $row = $table->potential_row; my $other = $table->potential_row( values => { name => 'Ralph' } ); $row->make_live; # $row is now a _real_ row object!
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.
Alzabo::Runtime::Table->potential_row
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.
make_live
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.
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.
Alzabo::Runtime::Row
In addition, no attempt is made to enforce referential integrity constraints on this object.
These methods all operate as they do for Alzabo::Runtime::Row objects.
This method throws an exception as it is not meaningful to try to delete a row that does not exist in the database.
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.
Indicates whether or not a given row is a real or potential row.
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.
Alzabo::Runtime::Table->insert
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.
insert
pk
values
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.