remove debug warning from last commit
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / PK / Auto / DB2.pm
CommitLineData
f6a3f5ae 1package DBIx::Class::PK::Auto::DB2;
2
3use strict;
4use warnings;
5
6use base qw/DBIx::Class/;
7
8__PACKAGE__->load_components(qw/PK::Auto/);
9
10sub last_insert_id
11{
12 my ($self) = @_;
13
66d9ef6b 14 my $dbh = $self->result_source->storage->dbh;
247f473a 15 my $sth = $dbh->prepare_cached("VALUES(IDENTITY_VAL_LOCAL())", {}, 3);
f6a3f5ae 16 $sth->execute();
17
18 my @res = $sth->fetchrow_array();
19
20 return @res ? $res[0] : undef;
21
22}
f6359592 23
241;
eb49d4e3 25
26=head1 NAME
27
28DBIx::Class::PK::Auto::DB2 - Automatic primary key class for DB2
29
30=head1 SYNOPSIS
31
32 # In your table classes
33 __PACKAGE__->load_components(qw/PK::Auto::DB2 Core/);
34 __PACKAGE__->set_primary_key('id');
35
36=head1 DESCRIPTION
37
38This class implements autoincrements for DB2.
39
40=head1 AUTHORS
41
42Jess Robinson
43
44=head1 LICENSE
45
46You may distribute this code under the same terms as Perl itself.
47
48=cut