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