DBIx::StORM::Inflater

Summary
DBIx::StORM::Inflater
DBIx::StORM::InflaterAn abstract class for developing inflaters/deflaters.
Functions
inflate (public instance)Take a row of data from the database and turn it into an in-memory representation of the row to work with.
deflate (public instance)Deflate a given set of values for a record into database format.
inflate_field (public instance)Inflate a field at access-time
deflate_field (public instance)Deflate a field at access-time

DBIx::StORM::Inflater

An abstract class for developing inflaters/deflaters.  An inflater gets access to the data before it is converted into a record, so it can tweak the data in some way.  A deflater performs the opposite, so that inflated values can be saved.  The archetypal use-case is something that converts SQL date values into objects of one’s preferred date class.

There is one class that handles both inflation and deflation, and it ought to be able to round-trip data.

=end NaturalDocs

Summary
Functions
inflate (public instance)Take a row of data from the database and turn it into an in-memory representation of the row to work with.
deflate (public instance)Deflate a given set of values for a record into database format.
inflate_field (public instance)Inflate a field at access-time
deflate_field (public instance)Deflate a field at access-time

Functions

inflate (public instance)

sub inflate

Take a row of data from the database and turn it into an in-memory representation of the row to work with.

The important thing here is the $table_mapping.  It consists of an array of strings, where each string specifies a table name/field name specification.  Table information is included as one select may select from more than one table (where foreign keys are involved).

A typical value may be “variety->fruit_id->name” which specifies that starting from the table “variety”, a look-up was made via the “fruit_id” column into another table, from which the field “name” has been loaded.  It is stored in $values at the same array index as this string is in $table_mapping.

Values may have as few as one “->” if they come from the “base” table of the query, or may be nested deeply.

Parameters

Object $stormThe DBIx::StORM object this query came from
ArrayRef $valuesThe values fetched from the database
Object $sthThe DBI statement handle for the row fetched
ArrayRef $table_mappingTable information as described above

Returns

ArrayRefThe inflated equivilent of $values, to be used in the object

=end NaturalDocs

deflate (public instance)

sub deflate

Deflate a given set of values for a record into database format.

Parameters

Object $stormThe DBIx::StORM object this query came from
ArrayRef $valuesThe array of values to be inserted, as described in the documentation for insert.
ArrayRef $table_mappingA table mapping of columns, as described in the documentation for insert.  Like insert, the deflater may be processing values for several related tables at once.

Returns

ArrayRefThe deflated equivilent of $values

=end NaturalDocs

inflate_field (public instance)

sub inflate_field

Inflate a field at access-time

Parameters

Object $recordThe DBIx::StORM::Record object this query came from
ArrayRef $contentThe array of values in the record.
ArrayRef $table_mappingA table mapping of columns, as described in the documentation for insert.
ScalarRef $valuerefA reference to the scalar we’re planning to return to the user.
String $fieldThe field being inflated.

Returns

Nothing

=end NaturalDocs

deflate_field (public instance)

sub deflate_field

Deflate a field at access-time

Parameters

Object $recordThe DBIx::StORM::Record object this query came from
ArrayRef $contentThe array of values in the record.
ArrayRef $table_mappingA table mapping of columns, as described in the documentation for insert.
ScalarRef $valuerefA reference to the scalar we received from the user.
String $fieldThe field being deflated.

Returns

Nothing

=end NaturalDocs

sub inflate
Take a row of data from the database and turn it into an in-memory representation of the row to work with.
sub deflate
Deflate a given set of values for a record into database format.
sub inflate_field
Inflate a field at access-time
sub deflate_field
Deflate a field at access-time
Close