DBIx:: StORM:: RecordSet

Summary
An array of cached results from parsing perl subroutine references into SQL.
A cache of recommended columns for a given RecordSet.
Inspect a filter target (may be a string for code reference) and decide how best to handle it.
Actually parse a perl code reference and turn it into a glob of SQL
Create a DBIx::StORM::FilteredRecordSet to represent a filtered set of results from the database.
Create a DBIx::StORM::OrderedRecordSet to represent the same records as in this object, but sorted into a particular order.
Create a DBIx::StORM::RecordSetWithView to represent a set of results from the database with computed columns
Fetch the first row from this RecordSet, and optionally fetch a particular field from it.
Fetch a string uniquely identifying this filter
Fetch a list of recommended columns for this filter
Recommend a new column for this filter to pre-fetch in future
Fetch the table object underlying this RecordSet
Actually do the query, and return a tied array that can be used to access the DBIx::StORM::Record objects.
Actually do the query, and return an array of DBIx::StORM::Record objects.
Execute the query and set up a DBI statement handle
Get the DBIx::StORM object this result set was created using

Variables

$filter_map (private static)

An array of cached results from parsing perl subroutine references into SQL.  The first level is a hash reference based on the usage of the subroutine (eg. filter, view, sort) and the next level is based on the stringified value of the code reference.

=end NaturalDocs

$recommended_columns (private static)

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)

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, view, order)

Returns

StringThe result of the parse

=end NaturalDocs

_parse (private instance)

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, view, 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

sort (public instance)

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

view (instance)

Create a DBIx::StORM::RecordSetWithView to represent a set of results from the database with computed columns

Parameters

%new_viewsThe view columns as hash with keys as a column name and values a code reference or string

Returns

An object of type DBIx::StORM::OrderedRecordSet

lookup (instance)

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

_filter_id (private instance)

Fetch a string uniquely identifying this filter

Parameters

None

Returns

StringThe filter ID

_recommended_columns (private_instance)

Fetch a list of recommended columns for this filter

Parameters

None

Returns

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

_recommend_column (private instance)

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

_table (private instance)

Fetch the table object underlying this RecordSet

Parameters

None

Returns

ObjectAn object of type DBIx::StORM::Table

_as_array (private instance)

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 class DBIx::StORM::RecordArray

array (instance)

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

Parameters

None

Returns

ArrayRefAn array of DBIx::StORM::Record Objects

_get_sth (private instance)

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

_storm (private instance)

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

Parameters

None

Returns

ObjectA DBIx::StORM object

_as_string

sub _as_string

update

sub update

delete

sub delete

_do_binding

sub _do_binding
sub _as_string
sub update
sub delete
sub _do_binding