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