Merge 'trunk' into 'DBIx-Class-current'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / DB2.pm
CommitLineData
843f8ecd 1package DBIx::Class::Storage::DBI::DB2;
2
3use strict;
4use warnings;
5
6use base qw/DBIx::Class::Storage::DBI/;
7
8# __PACKAGE__->load_components(qw/PK::Auto/);
9
10sub last_insert_id
11{
12 my ($self) = @_;
13
a9f32dbc 14 my $sth = $self->dbh_do(sub { shift->prepare_cached("VALUES(IDENTITY_VAL_LOCAL())", {}, 3) });
843f8ecd 15 $sth->execute();
16
17 my @res = $sth->fetchrow_array();
18
19 return @res ? $res[0] : undef;
20
21}
22
45fa8288 23sub datetime_parser_type { "DateTime::Format::DB2"; }
24
843f8ecd 251;
26
75d07914 27=head1 NAME
843f8ecd 28
29DBIx::Class::Storage::DBI::DB2 - Automatic primary key class for DB2
30
31=head1 SYNOPSIS
32
33 # In your table classes
34 __PACKAGE__->load_components(qw/PK::Auto Core/);
35 __PACKAGE__->set_primary_key('id');
36
37=head1 DESCRIPTION
38
39This class implements autoincrements for DB2.
40
41=head1 AUTHORS
42
43Jess Robinson
44
45=head1 LICENSE
46
47You may distribute this code under the same terms as Perl itself.
48
49=cut