1package DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL; 2use strict; 3use warnings; 4 5use base qw/DBIx::Class::Storage::DBI::ODBC/; 6use mro 'c3'; 7 8sub _dbh_last_insert_id { 9 my ($self, $dbh, $source, $col) = @_; 10 11 # get the schema/table separator: 12 # '.' when SQL naming is active 13 # '/' when system naming is active 14 my $sep = $dbh->get_info(41); 15 my $sth = $dbh->prepare_cached( 16 "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM${sep}SYSDUMMY1", {}, 3); 17 $sth->execute(); 18 19 my @res = $sth->fetchrow_array(); 20 21 return @res ? $res[0] : undef; 22} 23 24sub _sql_maker_opts { 25 my ($self) = @_; 26 27 $self->dbh_do(sub { 28 my ($self, $dbh) = @_; 29 30 return { 31 limit_dialect => 'FetchFirst', 32 name_sep => $dbh->get_info(41) 33 }; 34 }); 35} 36 371; 38 39=head1 NAME 40 41DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL - Support specific to DB2/400 42over ODBC 43 44=head1 SYNOPSIS 45 46 # In your result (table) classes 47 use base 'DBIx::Class::Core'; 48 __PACKAGE__->set_primary_key('id'); 49 50 51=head1 DESCRIPTION 52 53This class implements support specific to DB2/400 over ODBC, including 54auto-increment primary keys, SQL::Abstract::Limit dialect, and name separator 55for connections using either SQL naming or System naming. 56 57 58=head1 AUTHORS 59 60Marc Mims C<< <marc@questright.com> >> 61 62Based on DBIx::Class::Storage::DBI::DB2 by Jess Robinson. 63 64=head1 LICENSE 65 66You may distribute this code under the same terms as Perl itself. 67 68=cut 69