GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DBIX::SQLENGINE::DRIVER::TRAIT::NOSEQUENCES (3)

.ds Aq ’

NAME

DBIx::SQLEngine::Driver::Trait::NoSequences - For databases without native sequences

CONTENTS

SYNOPSIS



  # Classes can import this behavior if they dont 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();



DESCRIPTION

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.

    About Driver Traits

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.

REFERENCE

The following methods are provided:

    Insert to Add Data

do_insert_with_sequence()


  $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().

    Sequence Table

seq_fetch_current()


  $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.

sql_seq_fetch_current()


  $sqldb->sql_seq_fetch_current( $table, $field ) : $sql, @params



Returns a SQL statement to fetch the current value from the sequence table.

seq_increment()


  $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.

sql_seq_increment()


  $sqldb->sql_seq_increment( $table, $field, $current, $next ) : $sql, @params



Generates a SQL statement for use by seq_increment().

seq_table_name() Constant ’dbix_sqlengine_seq’.
seq_create_table()


  $sqldb->seq_create_table()



Issues a SQL create table statement to create the sequence table.

seq_drop_table()


  $sqldb->seq_drop_table()



Issues a SQL drop table statement to remove the sequence table.

seq_insert_record()


  $sqldb->seq_insert_record( $table, $field )



Creates a record in the sequence table for a given field in a particular table.

seq_delete_record()


  $sqldb->seq_delete_record( $table, $field )



Removes the corresponding record in the sequence table.

seq_bootstrap_init()


  $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 ALSO

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.

POD ERRORS

Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 326: You forgot a ’=back’ before ’=head1’
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SQLENGINE::DRIVER::TRAIT::NOSEQUENCES (3) 2004-11-13

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.