DBIx::StORM::Table |
| DBIx:: | |
| DBIx:: | An StORM class representing a table. |
| Functions | |
| _new (private instance) | Create a new DBIx::StORM::Table object from a connection. |
| _get_sth (private instance) | Actually run the query using the DBI and the SQLDriver and return a result statement handle. |
| name (public instance) | Get the name of the table this object represents |
| insert (public instance) | Insert a new row into the table |
| _filter_id (private instance) | All RecordSets need a unique string identifier which is used for caching. |
| primary_key (public instance) | Fetch a list of all the primary key column names in this table. |
| foreign_keys (public instance) | Fetch a hash of all the foreign keys in this table. |
| grep (public instance) | Filter this DBIx::StORM::RecordSet by applying a result filter. |
| sort (public instance) | Sort this DBIx::StORM::RecordSet by applying a sort routine. |
| grep_pp (public instance) | Filter this DBIx::StORM::RecordSet using a perl filter. |
| _build_result_identity | |
| _rebuild_record (private instance) | This is called by a DBIx::StORM::Record when the content has changed or the column set loaded is incorrect. |
| _get_record_for_fk (private instance) | When a foreign key column in a Record from this table is access, this method is called to generate the Record record for the foreign key. |
| _table (private instance) | All RecordSets need to be able to quickly fetch the underlying DBIx::StORM::Table object it is derived from. |
| identity (public instance) | Fetch the record that has a given primary key value. |
| PUSH (private instance) | Insert a new row into the table through array emulation. |
DBIx::StORM::Table |
An StORM class representing a table.
This class inherits from DBIx::StORM::RecordSet, so can be grep’d (filtered), and sorted. You can also insert new rows. Tables can be array dereferenced to iterate over the rows in the table.
| Functions | |
| _new (private instance) | Create a new DBIx::StORM::Table object from a connection. |
| _get_sth (private instance) | Actually run the query using the DBI and the SQLDriver and return a result statement handle. |
| name (public instance) | Get the name of the table this object represents |
| insert (public instance) | Insert a new row into the table |
| _filter_id (private instance) | All RecordSets need a unique string identifier which is used for caching. |
| primary_key (public instance) | Fetch a list of all the primary key column names in this table. |
| foreign_keys (public instance) | Fetch a hash of all the foreign keys in this table. |
| grep (public instance) | Filter this DBIx::StORM::RecordSet by applying a result filter. |
| sort (public instance) | Sort this DBIx::StORM::RecordSet by applying a sort routine. |
| grep_pp (public instance) | Filter this DBIx::StORM::RecordSet using a perl filter. |
| _build_result_identity | |
| _rebuild_record (private instance) | This is called by a DBIx::StORM::Record when the content has changed or the column set loaded is incorrect. |
| _get_record_for_fk (private instance) | When a foreign key column in a Record from this table is access, this method is called to generate the Record record for the foreign key. |
| _table (private instance) | All RecordSets need to be able to quickly fetch the underlying DBIx::StORM::Table object it is derived from. |
| identity (public instance) | Fetch the record that has a given primary key value. |
| PUSH (private instance) | Insert a new row into the table through array emulation. |
sub _new
Create a new DBIx::StORM::Table object from a connection.
| Object $storm | A connection of type DBIx::StORM |
| String $table | The table name as a string |
| Object | A new DBIx::StORM::Table object |
sub _get_sth
Actually run the query using the DBI and the SQLDriver and return a result statement handle. This is a simpler, speedier version of that in DBIx::StORM::RecordSet.
None
| Object | The DBI statement handle of results |
| Hash | A hash map of column references to result array indices |
sub foreign_keys
Fetch a hash of all the foreign keys in this table.
The hash key is the string name of the foreign key column in this table, and the value is a table reference to the column in the foreign table.
None
| HashList | Details of the foreign keys used by this table. |
sub grep_pp
Filter this DBIx::StORM::RecordSet using a perl filter. This is identical to the <grep> method, but does not attempt to parse the subref and optimise it.
| SubRef | The filter code as a perl subroutine reference |
| Object | A new DBIx::StORM::RecordSet which contains just the matching rows |
sub _rebuild_record
This is called by a DBIx::StORM::Record when the content has changed or the column set loaded is incorrect. It causes the object to be rebuilt with a new set of column. The object is modified in-situ. The row is selected from the database by primary key column equality, so it won’t work on tables without a PK.
| Object $record | DBIx::StORM::Record to rebuild |
| Boolean $full | Whether to fetch all rows, or just the ones requested by the record object |
None
sub _get_record_for_fk
When a foreign key column in a Record from this table is access, this method is called to generate the Record record for the foreign key.
| String $column | the name of the foreign key column |
| String $value | the value of the column in the calling record |
| Object $resultset | the resultset that the calling record came from |
| String $base_ref | the path to the table the calling record comes from |
| HashRef $table_mapping | the calling record’s mapping of column references to content indexes |
| ArrayRef $content | The column values contained in the calling record |
| Object | A DBIx::StORM::Record |
sub identity
Fetch the record that has a given primary key value. For one-column primary keys you can pass in the value directly. Otherwise a hash reference should be passed in of field name => field value mappings.
If you incorrectly specify the primary key this function will die.
| $primary_key_info | Either a value or hashref specifying the primary key value(s) of the desired Record. |
| Object | Object of type DBIx::StORM::Record |
sub PUSH
Insert a new row into the table through array emulation.
If $row is an object of class DBIx::StORM::Record then it will be inserted into the table (an exception will be thrown if this record was created for a different table.
If $row is a subroutine reference then a new record will be created and passed into the subroutine as $_. The subroutine can then initalise the record, which will be written to the database on completion of the subroutine.
If $row is a hashref then a new record will be created and the fields will be copied from the hash and into the record.
| $row | The record to insert |
| $rows | The number of rows in the table |
Create a new DBIx::StORM::Table object from a connection.
sub _new
Actually run the query using the DBI and the SQLDriver and return a result statement handle.
sub _get_sth
Get the name of the table this object represents
sub name
Insert a new row into the table
sub insert
All RecordSets need a unique string identifier which is used for caching.
sub _filter_id
Fetch a list of all the primary key column names in this table.
sub primary_key
Fetch a hash of all the foreign keys in this table.
sub foreign_keys
Filter this DBIx::StORM::RecordSet by applying a result filter.
sub grep
Sort this DBIx::StORM::RecordSet by applying a sort routine.
sub sort
Filter this DBIx::StORM::RecordSet using a perl filter.
sub grep_pp
sub _build_result_identity
This is called by a DBIx::StORM::Record when the content has changed or the column set loaded is incorrect.
sub _rebuild_record
When a foreign key column in a Record from this table is access, this method is called to generate the Record record for the foreign key.
sub _get_record_for_fk
All RecordSets need to be able to quickly fetch the underlying DBIx::StORM::Table object it is derived from.
sub _table
Fetch the record that has a given primary key value.
sub identity
Insert a new row into the table through array emulation.
sub PUSH