NAME

DBIx::QueryByName::QueryPool - Manages a pool of sql query descriptions

DESCRIPTION

An instance of DBIx::QueryByName::QueryPool stores the descriptions of all the queries that can be executed with corresponding instances of DBIx::QueryByName.

DO NOT USE DIRECTLY!

INTERFACE

This API is subject to change!

my $pool = DBIx::QueryByName::QueryPool->new();

Instanciate DBIx::QueryByName::QueryPool.

$pool->add_query(name => $name, sql => $sql, session => $session, result => $result, params => \@params);

Add a query to this pool. $result must be one of 'sth', 'scalar', 'hash', 'scalariterator', 'hashiterator'. Example:

$pool->add_query(name => 'get_user_adress',
                 sql => 'SELECT adress FROM adresses WHERE firstname=? AND lastname=?',
                 result => 'sth',
                 params => [ 'firstname', 'lastname' ],
                 session => 'name_of_db_connection',
                 retry => 'never',
                );
$pool->knows_query($name);

True if the pool already contains a query with that name. False otherwise.

$pool->delete_queries($session);

Remove all the queries added under session $session.

my ($session,$sql,@params) = $pool->get_query($name);

Return the name of the database session, the sql code and the named parameters of the query named $name. Croak if no query with that name.

my $retry = $pool->get_retry_attribute($name);

Return the retry attribute for this query, one of 'always', 'never' or 'safe'.