Role::Pg::Sequences - Client Role for handling PostgreSQL Sequences
version 0.002
This role handles the use of Sequences in a PostgreSQL database.
Role::Pg::Sequences
Role::Pg::Sequences tries to guess your dbh. If it isn't a standard dbi::db named dbh, or constructed in a dbix::class schema called schema, you have to return the dbh from _build_sequences_dbh.
Should be set to the name of the database schema to hold the sequence. Default "public".
$self->create_sequence(sequence => 'my_sequence'); Optional parameters: temporary - if set, means that the sequence is temporary and will disappear when the current session is closed increment - the value that the sequence will be incremented by minvalue - the minimumn value of the sequence. Default 1 maxvalue - the maximum value of the sequence. Default 2^63-1 start - Which value to be the first. Default minvalue cache - How many sequence numbers to cache
Creates a sequence.
An optional password can be added. The user (or group) is then created with an encrypted password.
$self->drop_sequence(sequence => 'my_sequence');
Drops a sequence.
print "It's there" if $self->sequence_exists(sequence => 'my_sequence');
Returns true if the sequence exists.
my $sequence_value = $self->nextval(sequence => 'my_sequence');
Increments and returns the next value of the sequence
$self->nextval(sequence => 'my_sequence', value => $new_value); Returns the new value The optional parameter is_called determines if the value is already incremented. Set this parameter to a false value if you want the next nextval to NOT increment the value.
Sets the value of the sequence
my $sequence_value = $self-lastval;
Returns the latest value of any sequence
Kaare Rasmussen <kaare@cpan.org>.
Copyright (C) 2015, Kaare Rasmussen
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
Kaare Rasmussen <kaare at cpan dot net>
This software is copyright (c) 2015 by Kaare Rasmussen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Role::Pg::Sequences, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Role::Pg::Sequences
CPAN shell
perl -MCPAN -e shell install Role::Pg::Sequences
For more information on module installation, please visit the detailed CPAN module installation guide.