DbFramework::Persistent - Persistent Perl object base class
package Foo; use base qw(DbFramework::Persistent); package main; $foo = new Foo($table,$dbh,$catalog); $foo->attributes_h(\%foo}; $foo->insert; $foo->attributes_h(\%new_foo); $foo->update(\%attributes); $foo->delete; $foo->init_pk; @foo = $foo->select($condition,$order); $hashref = $foo->table_qualified_attribute_hashref; $code = DbFramework::Persistent::make_class($name);
Base class for persistent objects which use a DBI database for storage. To create your own persistent object classes subclass DbFramework::Persistent (see the make_class() class method.)
Create a new persistent object. $table is a DbFramework::Table object or the name of a database table. $dbh is a DBI database handle which refers to a database containing a table associated with $table. $catalog is a DbFramework::Catalog object.
Returns some Perl code which can be used with eval() to create a new persistent object (sub)class called $name.
Attributes in a persistent object which relate to columns in the associated table are made available through the attribute ATTRIBUTES_H. See "AUTOLOAD()" in DbFramework::Util for the accessor methods for this attribute.
Delete this object from the associated table based on the values of it's primary key attributes. Returns the number of rows deleted if supplied by the DBI driver.
Insert this object in the associated table. Returns the primary key of the inserted row if it is a Mysql 'AUTO_INCREMENT' column or -1.
Update this object in the associated table. %attributes is a hash whose keys contain primary key column names and whose values will be concatenated with 'ANDs' to form a SQL 'WHERE' clause. The default values of %attributes is the hash returned by attributes_h(). Pass the current primary key attributes as an argument in %attributes when you need to update one or more primary key columns. Returns the number of rows updated if supplied by the DBI driver.
Returns a list of objects of the same class as the object which invokes it. Each object in the list has its attributes initialised from the values returned by selecting all columns from the associated table matching $conditions ordered by the list of columns in $order.
Returns an HTML form representing the object, filled with the object's attribute values.
Initialise an object by setting its attributes based on the current value of the its primary key attributes.
Returns a reference to a hash whose keys are the keys of %ATTRIBUTES_H with a prefix of $table, where $table is the table associated with the object and whose values are values from %ATTRIBUTES_H. This is useful for filling a template (see "fill()" in DbFramework::Template.)
Paul Sharpe <firstname.lastname@example.org>
Copyright (c) 1997,1998,1999 Paul Sharpe. England. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.