DBIx::SQLEngine::Driver::Trait::NoSequences - For databases without native sequences
# Classes can import this behavior if they don't have native sequences use DBIx::SQLEngine::Driver::Trait::NoSequences ':all'; # Public interface for NoSequences functionality $nextid = $sqldb->seq_increment( $table, $field ); # Housekeeping functions for setup and removal $sqldb->seq_create_table(); $sqldb->seq_insert_record( $table, $field ); $sqldb->seq_delete_record( $table, $field ); $sqldb->seq_drop_table();
This package supports SQL database servers which do natively support an auto-incrementing or unique sequence trigger. Instead, a special table is allocated to store sequence values, and queries are used to atomically retrieve and increment the sequence value to ensure uniqueness.
You do not need to use this package directly; it is used internally by those driver subclasses which need it.
For more information about Driver Traits, see "About Driver Traits" in DBIx::SQLEngine::Driver.
The following methods are provided:
$sqldb->do_insert_with_sequence( $seq_name, %sql_clauses ) : $row_count
Insert a single row into a table in the datasource, using a sequence to fill in the values of the column named in the first argument. Should return 1, unless there's an exception.
Implemented with _seq_do_insert_preinc() and seq_increment().
$sqldb->seq_fetch_current( $table, $field ) : $current_value
Fetches the current sequence value.
Implemented as an exception-handling wrapper around the query defined in sql_seq_fetch_current(), which attempts to create the sequence table if it doesn't exist and insert a row for this sequence if needed.
$sqldb->sql_seq_fetch_current( $table, $field ) : $sql, @params
Returns a SQL statement to fetch the current value from the sequence table.
$sqldb->seq_increment( $table, $field ) : $new_value
Increments the sequence, and returns the newly allocated value.
This is the primary "public" interface of this package.
If someone else has completed the same increment before we have, our update will have no effect and we'll immediately try again and again until successful.
If the table does not yet exist, attempts to create it automatically.
If the sequence record does not yet exist, attempts to create it automatically.
$sqldb->sql_seq_increment( $table, $field, $current, $next ) : $sql, @params
Generates a SQL statement for use by seq_increment().
Issues a SQL create table statement to create the sequence table.
Issues a SQL drop table statement to remove the sequence table.
$sqldb->seq_insert_record( $table, $field )
Creates a record in the sequence table for a given field in a particular table.
$sqldb->seq_delete_record( $table, $field )
Removes the corresponding record in the sequence table.
$sqldb->seq_bootstrap_init( $table, $field ) : $current_value
Scans the designated field in a given table to determine its maximum value, and then stores that in sequence table.
See DBIx::SQLEngine for the overall interface and developer documentation.
See DBIx::SQLEngine::Docs::ReadMe for general information about this distribution, including installation and license information.
See DBIx::Sequence for another version of the sequence-table functionality, which greatly inspired this module.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 326:
You forgot a '=back' before '=head1'