Commit | Line | Data |
843f8ecd |
1 | package DBIx::Class::Storage::DBI::DB2; |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use base qw/DBIx::Class::Storage::DBI/; |
2ad62d97 |
7 | use mro 'c3'; |
843f8ecd |
8 | |
6a247f33 |
9 | __PACKAGE__->sql_limit_dialect ('RowNumberOver'); |
10 | |
d4f16b21 |
11 | sub _dbh_last_insert_id { |
12 | my ($self, $dbh, $source, $col) = @_; |
843f8ecd |
13 | |
d4f16b21 |
14 | my $sth = $dbh->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; |
843f8ecd |
20 | } |
21 | |
45fa8288 |
22 | sub datetime_parser_type { "DateTime::Format::DB2"; } |
23 | |
843f8ecd |
24 | 1; |
25 | |
75d07914 |
26 | =head1 NAME |
843f8ecd |
27 | |
28 | DBIx::Class::Storage::DBI::DB2 - Automatic primary key class for DB2 |
29 | |
30 | =head1 SYNOPSIS |
31 | |
32 | # In your table classes |
d88ecca6 |
33 | use base 'DBIx::Class::Core'; |
843f8ecd |
34 | __PACKAGE__->set_primary_key('id'); |
35 | |
36 | =head1 DESCRIPTION |
37 | |
38 | This class implements autoincrements for DB2. |
39 | |
40 | =head1 AUTHORS |
41 | |
42 | Jess Robinson |
43 | |
44 | =head1 LICENSE |
45 | |
46 | You may distribute this code under the same terms as Perl itself. |
47 | |
48 | =cut |