New DB2 Automagic primary key collecting
[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
14 my $dbh = $self->storage->dbh;
15 my $sth = $dbh->prepare_cached("VALUES(IDENTITY_VAL_LOCAL())");
16 $sth->execute();
17
18 my @res = $sth->fetchrow_array();
19
20 return @res ? $res[0] : undef;
21
22}