NAME
DBIx::Class::LookupColumn::Manager - a lazy cache system for storing Lookup tables.
VERSION
Version 0.07
SYNOPSIS
use DBIx::Class::LookupColumn::Manager;
DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME( $schema, 'PermissionType', 'name', 'Administrator' );
DBIx::Class::LookupColumn::Manager->FETCH_NAME_BY_ID( $schema, 'PermissionType', 'name', 1 );
DESCRIPTION
This class is not intended to be used directly. It is the backbone of the DBIx::Class::LookupColumn module.
It stores Lookup tables ( (id, name) ) in a structure and indexes ids and names both ways, so that it is fast to test if a given name is defined by a Lookup table.
This module only supports tables having only one single primary key.
STATIC METHODS
FETCH_ID_BY_NAME
$id = DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME($schema, $lookup_table, $field_name, $name)
Returns the id associated with the value $name
in the column $field_name
of the Lookup table named $lookup_table
.
As a side-effect, it will lazy-load the table $lookup_table
in the cache.
Arguments:
- $schema
-
The DBIx::Class::Schema schema instance.
- $lookup_table
-
The name of the Lookup table.
- $field_name
-
The name of the column of the Lookup table that contains the value of the terms/definitions (e.g. 'name').
- $name
-
The value in the column
$field_name
we want to fetch the primary key for.
Example:
my $admin_id = DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME( $schema, 'UserType', 'name', 'Administrator' ).
FETCH_NAME_BY_ID
$name = DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME($schema, $lookup_table, $field_name, $id)
Returns the name associated with the id $id
in the column $field_name
of the Lookup table named $lookup_table
.
As a side-effect, it will lazy-load the table $lookup_table
in the cache.
Arguments:
- $schema
-
The DBIx::Class::Schema schema instance.
- $lookup_table
-
The name of the Lookup table.
- $field_name
-
The name of the column of the Lookup table that contains the value of the terms/definitions (e.g. 'name').
- $id
-
The id
$id
in the column$field_name
we want to fetch the value for.
Example:
my $type_name = DBIx::Class::LookupColumn::Manager->FETCH_NAME_BY_ID( $schema, 'UserType', 'name', 1 ).
AUTHORS
Karl Forner <karl.forner@gmail.com>
Thomas Rubattel <rubattel@cpan.org>
BUGS
Please report any bugs or feature requests to bug-dbix-class-lookupcolumn-manager at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-LookupColumn-Manager. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc DBIx::Class::LookupColumn::Manager
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-LookupColumn-Manager
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
http://cpanratings.perl.org/d/DBIx-Class-LookupColumn-Manager
Search CPAN
http://search.cpan.org/dist/DBIx-Class-LookupColumn-Manager/
LICENCE AND COPYRIGHT
Copyright 2012 Karl Forner and Thomas Rubattel, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the terms as Perl itself.