The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPOPS::Key::DBI::Pool -- Retrieves ID field information from a pool

SYNOPSIS

 # In your configuration file

 # Bind the value 'unique_value' to the field 'table'

 my $spops = {
   isa => [ qw/ SPOPS::Key::DBI::Pool SPOPS::DBI / ],
   pool_sql   => 'select my_key from key_pool where table = ?',
   pool_value => [ 'unique_value' ],
   ...
 };


 # Use the values 'unique_value' and 'my_location' but use quoting
 # rather than binding (some DBDs don't let you use bound values with
 # stored procedures)

 my $spops = {
   isa => [ qw/ SPOPS::Key::DBI::Pool SPOPS::DBI / ],
   pool_sql   => 'exec new_key %s, %s',
   pool_value => [ 'unique_value', 'my_location' ],
   pool_quote => 1,
   ...
 };

DESCRIPTION

This module retrieves a value from a pool of key values matched up to tables. It is not as fast as IDENTITY fields (SPOPS::Key::DBI::Identity, auto_incrementing values or sequences, but can be portable among databases and, most importantly, works in a replicated environment. It also has the benefit of being fairly simple to understand.

Currently, the key fetching procedure is implemented via a stored procedure for portability among tools in different languages, but it does not have to remain this way. It is perfectly feasible to program the entire procedure in perl.

BUGS

Put this class before others in ISA

Not really a bug, but you must put this class before any database-specific ones (like 'SPOPS::DBI::Sybase' or whatnot) in your @ISA, otherwise this class will not be able to do its work.

TO DO

It might be a good idea to subclass this with a pure Perl solution.

COPYRIGHT

Copyright (c) 2001-2004 intes.net, inc.. All rights reserved.

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

AUTHORS

Chris Winters <chris@cwinters.com>