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/; |
7 | |
8 | # __PACKAGE__->load_components(qw/PK::Auto/); |
9 | |
d4f16b21 |
10 | sub _dbh_last_insert_id { |
11 | my ($self, $dbh, $source, $col) = @_; |
843f8ecd |
12 | |
d4f16b21 |
13 | my $sth = $dbh->prepare_cached('VALUES(IDENTITY_VAL_LOCAL())', {}, 3); |
843f8ecd |
14 | $sth->execute(); |
15 | |
16 | my @res = $sth->fetchrow_array(); |
17 | |
18 | return @res ? $res[0] : undef; |
843f8ecd |
19 | } |
20 | |
45fa8288 |
21 | sub datetime_parser_type { "DateTime::Format::DB2"; } |
22 | |
ac788c46 |
23 | sub _sql_maker_opts { |
24 | my ( $self, $opts ) = @_; |
25 | |
26 | if ( $opts ) { |
27 | $self->{_sql_maker_opts} = { %$opts }; |
28 | } |
29 | |
30 | return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} }; |
31 | } |
32 | |
843f8ecd |
33 | 1; |
34 | |
75d07914 |
35 | =head1 NAME |
843f8ecd |
36 | |
37 | DBIx::Class::Storage::DBI::DB2 - Automatic primary key class for DB2 |
38 | |
39 | =head1 SYNOPSIS |
40 | |
41 | # In your table classes |
42 | __PACKAGE__->load_components(qw/PK::Auto Core/); |
43 | __PACKAGE__->set_primary_key('id'); |
44 | |
45 | =head1 DESCRIPTION |
46 | |
47 | This class implements autoincrements for DB2. |
48 | |
49 | =head1 AUTHORS |
50 | |
51 | Jess Robinson |
52 | |
53 | =head1 LICENSE |
54 | |
55 | You may distribute this code under the same terms as Perl itself. |
56 | |
57 | =cut |