DBIx::StORM::RecordSet

Summary
DBIx::StORM::RecordSet
Variables
$recommended_columns (private static)A cache of recommended columns for a given RecordSet.
Functions
_do_parse (private instance)Inspect a filter target (may be a string for code reference) and decide how best to handle it.
_parse (private instance)Actually parse a perl code reference and turn it into a glob of SQL
filter (public instance)Create a DBIx::StORM::FilteredRecordSet to represent a filtered set of results from the database.
grep
sort (public instance)Create a DBIx::StORM::OrderedRecordSet to represent the same records as in this object, but sorted into a particular order.
lookup (instance)Fetch the first row from this RecordSet, and optionally fetch a particular field from it.
_filter_id (private instance)Fetch a string uniquely identifying this filter
_recommended_columns (private_instance)Fetch a list of recommended columns for this filter
_recommend_column (private instance)Recommend a new column for this filter to pre-fetch in future
_table (private instance)Fetch the table object underlying this RecordSet
_as_array (private instance)Actually do the query, and return a tied array that can be used to access the DBIx::StORM::Record objects.
array (instance)Actually do the query, and return an array of DBIx::StORM::Record objects.
_get_sth (private instance)Execute the query and set up a DBI statement handle
_storm (private instance)Get the DBIx::StORM object this result set was created using
_as_string
update
delete
_do_binding
TIEARRAY
EXTEND
FETCH (private instance)Fetch a DBIx::StORM::Record object for the next result in the RecordSet.
FETCHSIZE

Variables

$recommended_columns (private static)

our $recommended_columns

A cache of recommended columns for a given RecordSet.  The first level is a hash reference of filter IDs, and each value is a hash of column names.

=end NaturalDocs

Functions

_do_parse (private instance)

sub _do_parse

Inspect a filter target (may be a string for code reference) and decide how best to handle it.  If it’s a SQL string, it’ll be fine as-is (it’s up to you to make sure it works!) whilst if it’s a perl CV it’ll need parsing into SQL and caching for next time.

Parameters

Scalar $filterThe code reference or the string to parse
String $modeThe type of parse required for perl (eg. select, order)

Returns

StringThe result of the parse

=end NaturalDocs

_parse (private instance)

sub _parse

Actually parse a perl code reference and turn it into a glob of SQL

Parameters

CodeRef $filterThe code reference to parse
String $modeThe type of parse required (eg. select, order)

Returns

StringThe result of the parse

=end NaturalDocs

filter (public instance)

Create a DBIx::StORM::FilteredRecordSet to represent a filtered set of results from the database.  The filter is usually a perl subroutine reference with the filtering logic in it, but could be a SQL WHERE component where use of perl isn’t appropriate.

Parameters

CodeRef $filterThe filter code as a code reference or string

Returns

ObjectAn object of type DBIx::StORM::FilteredRecordSet

=end NaturalDocs

grep

sub grep

sort (public instance)

sub sort

Create a DBIx::StORM::OrderedRecordSet to represent the same records as in this object, but sorted into a particular order.  The filter is usually a perl subroutine reference with the filtering logic in it, but could be a SQL ORDER BY component where use of perl isn’t appropriate.

Parameters

$filterThe filter code as a code reference or string

Returns

ObjectAn object of type DBIx::StORM::OrderedRecordSet

=end NaturalDocs

lookup (instance)

sub lookup

Fetch the first row from this RecordSet, and optionally fetch a particular field from it.

Parameters

$fieldOptionally, the field to return from the first row

Returns

An object of type DBIx::StORM::Record if no field is supplied or the field is a foreign key, otherwise a simple scalar

=end NaturalDocs

_filter_id (private instance)

sub _filter_id

Fetch a string uniquely identifying this filter

Parameters

None

Returns

StringThe filter ID

=end NaturalDocs

_recommended_columns (private_instance)

sub _recommended_columns

Fetch a list of recommended columns for this filter

Parameters

None

Returns

An array reference of strings representing the path of the recommended columns

=end NaturalDocs

_recommend_column (private instance)

sub _recommend_column

Recommend a new column for this filter to pre-fetch in future

Parameters

String $columnThe full path of the column to pre-fetch next time

Returns

Nothing

=end NaturalDocs

_table (private instance)

sub _table

Fetch the table object underlying this RecordSet

Parameters

None

Returns

ObjectAn object of type DBIx::StORM::Table

=end NaturalDocs

_as_array (private instance)

sub _as_array

Actually do the query, and return a tied array that can be used to access the DBIx::StORM::Record objects.  A tied array is used as it means a maximum of two result objects are kept in memory at once, but does mean you can’t randomly access or otherwise tweak the array

Parameters

None

Returns

ArrayRefAn array reference tied to this class.

=end NaturalDocs

array (instance)

sub array

Actually do the query, and return an array of DBIx::StORM::Record objects.  Unlike the array dereference, this returns a proper perl array rather than a tied array.  This means you can randomly access the results, but it also takes a lot of memory

It also means you can’t push() onto it to add more rows.

This method is likely to go away when the fake array gets real enough to fool.

Parameters

None

Returns

ArrayRefAn array of DBIx::StORM::Record Objects

=end NaturalDocs

_get_sth (private instance)

sub _get_sth

Execute the query and set up a DBI statement handle

Parameters

None

Returns

Object $sthA DBI statement handle from which query results can be fetched
HashRef $table_mappingA mapping of column references to result indices

=end NaturalDocs

_storm (private instance)

sub _storm

Get the DBIx::StORM object this result set was created using

Parameters

None

Returns

ObjectA DBIx::StORM object

=end NaturalDocs

_as_string

sub _as_string

update

sub update

delete

sub delete

_do_binding

sub _do_binding

TIEARRAY

sub TIEARRAY

EXTEND

sub EXTEND

FETCH (private instance)

sub FETCH

Fetch a DBIx::StORM::Record object for the next result in the RecordSet.

Parameters

String $indexThe column name to fetch

Returns

Objectof type DBIx::StORM::Record

=end NaturalDocs

FETCHSIZE

sub FETCHSIZE
our $recommended_columns
A cache of recommended columns for a given RecordSet.
sub _do_parse
Inspect a filter target (may be a string for code reference) and decide how best to handle it.
sub _parse
Actually parse a perl code reference and turn it into a glob of SQL
sub grep
sub sort
Create a DBIx::StORM::OrderedRecordSet to represent the same records as in this object, but sorted into a particular order.
sub lookup
Fetch the first row from this RecordSet, and optionally fetch a particular field from it.
sub _filter_id
Fetch a string uniquely identifying this filter
sub _recommended_columns
Fetch a list of recommended columns for this filter
sub _recommend_column
Recommend a new column for this filter to pre-fetch in future
sub _table
Fetch the table object underlying this RecordSet
sub _as_array
Actually do the query, and return a tied array that can be used to access the DBIx::StORM::Record objects.
sub array
Actually do the query, and return an array of DBIx::StORM::Record objects.
sub _get_sth
Execute the query and set up a DBI statement handle
sub _storm
Get the DBIx::StORM object this result set was created using
sub _as_string
sub update
sub delete
sub _do_binding
sub TIEARRAY
sub EXTEND
sub FETCH
Fetch a DBIx::StORM::Record object for the next result in the RecordSet.
sub FETCHSIZE
Close