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
SPOPS::Key::DBI::Sequence(3) User Contributed Perl Documentation SPOPS::Key::DBI::Sequence(3)

SPOPS::Key::DBI::Sequence -- Retrieve sequence values from a supported DBI database

 # In the SPOPS configuration (note that 'sequence_call' is optional
 # and if not given the default will be used)

 $spops = {
   'myspops' => {
       'isa' => [ qw/ SPOPS::Key::DBI::Sequence  SPOPS::DBI / ],
       'sequence_name' => 'mysequence',
       'sequence_call' => 'SELECT %s.nextval',
       ...
   },
 };

 # Note: Other classes (such as 'SPOPS::DBI::Pg') use this class
 # without requiring you to specify it or any of the configuration
 # information.

This class makes a call to a 'sequence' to retrieve a value for use as a unique ID. Sequence implementations vary among databases, but generally they ensure that the sequence always generates a unique number no matter how many times it is accesed and by how many different connections.

To configure your SPOPS object to get its ID values from a sequence you can set the following configuration information either in your object or in the parameters passed to "retrieve_sequence()":

sequence_name ($) (required)

This holds the name of the sequence. Databases can typically have many sequences but only one per table.

sequence_call ($) (optional)

This class comes with the default sequence call of:

 SELECT NEXTVAL( '$sequence_name' )

If you need to change this for your database, it should be in a form accessible by "sprintf" so we can plugin the sequence name. For instance:

 sequence_name => 'myseq',
 sequence_call => ' SELECT %s.nextval',

Will get expanded to:

 SELECT myseq.nextval

when the call is made to retrieve a sequence.

pre_fetch_id()

Calls "retrieve_sequence()" to get the sequence value and returns it.

retrieve_sequence( )

Performs the action to retrieve the sequence. Uses the sequence call and sequence name to make a SQL call to retrieve the next value from a sequence. This should be database-independent, and the parts that are not independent (such as the format of the sequence call) are configurable in either the object configuration or in the call to this method. (Method parameters take precedence.)

None known.

Nothing known.

DBI, PostgreSQL and Oracle databases, both of which have sequences.

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.

Chris Winters <chris@cwinters.com>
2004-06-02 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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