DBIx:: StORM:: Record

DBIx::StORM::Record
Summary
A StORM class representing an individual row from the database.
Create a new DBIx::StORM::Record object from the RecordSet.
Used by overloading to provide hash-reference access.
Fetch a field from the Record.
Fetch the scalar value of a “simple” (ie.
Turn a string column name into a fully qualified content path, and also check to see if it’s a foreign key lookup and fetch the result if so.
A string representation of the Record, used for overloading.
Whether to write changed rows back to the database as soon as possible.
Find Records in another table that have a foreign key that links back to this record.

DBIx:: StORM:: Record

DBIx::StORM::Record

A StORM class representing an individual row from the database.

This is essentially a wrapper for a result from a DBI statement handle.  It appears to be a hash reference, where the keys of the hash are the column names in the result and the hash values are the column values.

=end NaturalDocs

Summary
Create a new DBIx::StORM::Record object from the RecordSet.
Used by overloading to provide hash-reference access.
Fetch a field from the Record.
Fetch the scalar value of a “simple” (ie.
Turn a string column name into a fully qualified content path, and also check to see if it’s a foreign key lookup and fetch the result if so.
A string representation of the Record, used for overloading.
Whether to write changed rows back to the database as soon as possible.
Find Records in another table that have a foreign key that links back to this record.

Functions

_new (private instance)

Create a new DBIx::StORM::Record object from the RecordSet.  The Record may cover data from a lot of tables as it may have information for tables accessed as foreign keys.  Therefore a result has a concept of “base reference” which is the access path to this result, which is used to index into the map of columns.

Parameters

HashRef $paramsParameters to build the Record

Returns

ObjectA new DBIx::StORM::Record object

=end NaturalDocs

_as_tied_hash (private instance)

Used by overloading to provide hash-reference access.  The keys of this hash are the columns in the result (for this table only) and the values are the column values.

Parameters

None

Returns

HashRefA tied hash of the column information

=end NaturalDocs

get (public instance)

Fetch a field from the Record.  The field is returned as an l-value, so you can assign to it.  This is for people who don’t like the hash-reference style access.

Parameters

$fieldThe field to fetch from the row

Returns

Tied scalar as an l-valueThe scalar may be a reference, and is tied to class DBIx::StORM::TiedColumn

=end NaturalDocs

_get_simple_value (private instance)

Fetch the scalar value of a “simple” (ie. not foreign key) column.  This is used by TiedColumn and TiedRecord.

Parameters

$fieldThe qualified field to fetch
$raw_fieldThe string field name

Returns

Scalarthe column value, or undef on failure

=end NaturalDocs

_build_column_information_for_get (private instance)

Turn a string column name into a fully qualified content path, and also check to see if it’s a foreign key lookup and fetch the result if so.

Parameters

$fieldThe string column name to fetch

Returns

Variableundef on failure, one DBIx::StORM::Record on a foreign key lookup or a ($field, $raw_field) pair suitable for feeding to _get_simple_value for non-foreign columns.

=end NaturalDocs

_as_string (private instance)

A string representation of the Record, used for overloading.  We stringify to the primary key where possible.  This may sound perverse, but it means that

print $result->{foreign_key};

gives you the foreign key value as you’d expect.  It also makes for a reasonable serialisation.  If there is no primary key we serialise in the standard Perl fashion.

Parameters

None

Returns

Stringa printable value for this result

=end NaturalDocs

autocommit (public instance)

Whether to write changed rows back to the database as soon as possible.  This is my default true for rows loaded from a table, and false before a new row is inserted.

Auto committing can thrash the database with small queries if you make a lot of updates to a row quickly, so turning off autocommit will allow those changes to be written back with one query.

Parameters

None

Returns

Nothing

=end NaturalDocs

_not_invalid

sub _not_invalid

_as_bool

sub _as_bool

delete

sub delete

commit

sub commit

refresh

sub refresh

_update_content

sub _update_content

_fields

sub _fields

_update_field

sub _update_field

associated (public instance)

Find Records in another table that have a foreign key that links back to this record.

Parameters

String $tableTable to scan for links back to this record

Returns

ObjectA DBIx::StORM::RecordSet of records with a column that match

=end NaturalDocs

sub _not_invalid
sub _as_bool
sub delete
sub commit
sub refresh
sub _update_content
sub _fields
sub _update_field