DBIx:: StORM:: Inflater

Summary
An abstract class for developing inflaters/deflaters.
Take a row of data from the database and turn it into an in-memory representation of the row to work with.
Deflate a given set of values for a record into database format.

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
Take a row of data from the database and turn it into an in-memory representation of the row to work with.
Deflate a given set of values for a record into database format.

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.

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

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)

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

Parameters

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