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