NAME

DBIx::Class::LookupColumn::Manager - A lazzy dbic component caching queries.

VERSION

Version 0.01

SYNOPSIS

use DBIx::Class::LookupColumn::Manager; DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME( $schema, 'Permission', 'name', 'Administrator' );

DESCRIPTION

This module does DBIx::Class queries by means of arguments you passed by and stores the result in a nested hashing data structure (cache). It does a DBIx::Class query if and only if that one is not yet stored in the cache (lazziness).

This module only supports tables having only one single primary key.

The module closely works with the DBIx::Class::LookupColumn package which generates a few convenient methods (accessors) for accessing data in a lookup table from an associated belongs_to table. What is meant as lookup table is a table containing some terms definition, such as PermissionType (permission_id, name) with such data (1, 'Administrator'; 2, 'User'; 3, 'Reader') associated with a client table (also called target table) such as User, whose metas might look like this : (id, first_name, last_name, permission_id). Though the module could also be used in an independently way.

EXPORT

FETCH_ID_BY_NAME

FETCH_NAME_BY_ID

RESET_CACHE

RESET_CACHE_LOOKUP_TABLE

METHODS

FETCH_ID_BY_NAME

Arguments: $schema, $lookup_table, $field_name, $name.
Returned value: id in the lookup table.
Description : get the id stored in the lookup table for both the column and its value passed by argument.
Example: DBIx::Class::LookupColumn::Manager->FETCH_ID_BY_NAME( $schema, 'Permission', 'name', 'Administrator' ).

FETCH_NAME_BY_ID

Arguments: $schema, $lookup_table, $field_name, $id.
Returned value: the value of the $field_name in the lookup table.
Description : get the value stored in the lookup table for the column and the id passed by argument.
Example: DBIx::Class::LookupColumn::Manager->FETCH_NAME_BY_ID( $schema, 'Permission', 'name', 1 ).

RESET_CACHE

Arguments: no argument.
Returned value: no returned value.
Description: reset the whole nested hashing data structure.
Example: DBIx::Class::LookupColumn::Manager->RESET_CACHE.

RESET_CACHE_LOOKUP_TABLE

Arguments: name of the table whose data are stored in the cache.
Returned value: no returned value.
Description: reset the hashing whose key is the table's name argument.
Example: DBIx::Class::LookupColumn::Manager->RESET_CACHE_LOOKUP_TABLE('Permission').

_ENSURE_LOOKUP_IS_CACHED

Description: carries about doing a query if and only if that one is not yet stored in the cache. For internal use.

_GET_CACHE

Description: only for test purpose.

AUTHOR

Karl Forner <karl.forner@gmail.com>

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:

LICENCE AND COPYRIGHT

Copyright 2012 Karl Forner, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms as Perl itself.