1package DBIx::Class::PK::Auto;
2
3#use base qw/DBIx::Class::PK/;
4use base qw/DBIx::Class/;
5use strict;
6use warnings;
7
8=head1 NAME
9
10DBIx::Class::PK::Auto - Automatic primary key class
11
12=head1 SYNOPSIS
13
14use base 'DBIx::Class::Core';
15__PACKAGE__->set_primary_key('id');
16
17=head1 DESCRIPTION
18
19This class overrides the insert method to get automatically incremented primary
20keys.
21
22PK::Auto is now part of Core.
23
24See L<DBIx::Class::Manual::Component> for details of component interactions.
25
26=head1 LOGIC
27
28C<PK::Auto> does this by letting the database assign the primary key field and
29fetching the assigned value afterwards.
30
31=head1 METHODS
32
33=head2 insert
34
35The code that was handled here is now in Row for efficiency.
36
37=head2 sequence
38
39Manually define the correct sequence for your table, to avoid the overhead
40associated with looking up the sequence automatically.
41
42=cut
43
44sub sequence {
45    my ($self,$seq) = @_;
46    foreach my $pri ($self->primary_columns) {
47        $self->column_info($pri)->{sequence} = $seq;
48    }
49}
50
511;
52
53=head1 AUTHORS
54
55Matt S. Trout <mst@shadowcatsystems.co.uk>
56
57=head1 LICENSE
58
59You may distribute this code under the same terms as Perl itself.
60
61=cut
62