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