DBIx::Sequence is a simple SQL92 ID generator.
SYNOPSIS
use DBIx::Sequence;
my $sequence = new DBIx::Sequence({ dbh => $dbh });
my $next_id = $sequence->Next('dataset');
This module is intended to give easier portability to Perl database application by providing a database independant unique ID generator. This way, an application developer is not bound to use his database's SEQUENCE or auto_increment thus making his application portable on multiple database environnements.
This module implements a simple Spin Locker mechanism and is garanteed to return a unique value every time it is called, even with concurrent processes. It uses your database for its state storage with ANSI SQL92 compliant SQL. All SQL queries inside DBIx::Sequence are pre cached and very efficient especially under mod_perl.
INSTALLATION
perl Makefile.PL
make
make test
make install
Note:
If you decide to run extended tests for the module, you will have to provide the make test with a DSN (connect string) to your database (dbi:Driver:db;host=hostname) and a valid username/password combination for a privileged user.
DBIx::Sequence uses 2 tables for its operation, namely the dbix_sequence_state and the dbix_sequence_release tables. Those tables will be created if you run extended tests, if not you will need to create them yourself.
dbix_sequence_state:
| dataset | varchar(50) |
| state_id | int(11) |
dbix_sequence_release:
| dataset | varchar(50) |
| released_id | int(11) |
Those table names are overloadable at your convenience, see the OVERLOADING section for details.
Product's homepage
Requirements:
· Perl
What's New in This Release: [ read full changelog ]
· Included Trevor Shellhorn taint/SQL finish patch (tx!)
· Implemented the allow_id_reuse constructor parameter that superceded the old ALLOW_ID_REUSE constant. That specific constant has been renamed DEFAULT_ALLOW_ID_REUSE and now specifies a default value if the allow_id_reuse parameter is not passed to the constructor. Default is true. (Dan Kubb's suggestion, tx!)