logo
Free, Micro AI Code Reviews That Run on Git Commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, Micro AI Code Reviews That Run on Git Commit | Product Hunt git-lrc - Free, Micro AI Code Reviews That Run on Git Commit | Product Hunt

DBIx::Recordset::DBSeq - Sequence generator in DBI database

Author

       G.Richter (richter@dev.ecos.de)

Description

       DBIx::Recordset::FileSeq generates unique numbers. State is kept in the one table of a database
       accessible via DBI. With the new constructor you give an open database handle and specify the the table
       where state should be kept.  Optionaly you can give a min and a max values, which will be used for new
       sequences.

       With NextVal you can get the next value for the sequence of the given name.

       The table must created in the following form:

       create table
           (
           name    varchar (32),
           cnt     integer,
           maxcnt  integer,
           primary key name
           ) ;

       If the sequence value reaches the maxcnt value, NextVal will die with an error message. If maxcnt
       contains "null" there is no limit.

Name

       DBIx::Recordset::DBSeq - Sequence generator in DBI database

See Also

       DBIx::Recordset

perl v5.34.0                                       2022-06-13                              Recordset::DBSeq(3pm)

Synopsis

        use DBIx::Recordset::DBSeq ;

        $self = DBIx::Recordset::DBSeq ($dbh, 'sequences', $min, $max) ;

        $val1 = $self -> NextVal ('foo') ;
        $val2 = $self -> NextVal ('foo') ;
        $val3 = $self -> NextVal ('bar') ;

See Also