Rename incorrectly named internal method (has nothing to do with MySQL)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / ODBC / DB2_400_SQL.pm
CommitLineData
2a57124d 1package DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL;
d23f094e 2use strict;
3use warnings;
4
2a57124d 5use base qw/DBIx::Class::Storage::DBI::ODBC/;
2ad62d97 6use mro 'c3';
d23f094e 7
2149a4e9 8warn 'Major advances took place in the DBIC codebase since this driver'
9 .' (::Storage::DBI::ODBC::DB2_400_SQL) was written. However since the'
10 .' RDBMS in question is so rare it is not possible for us to test any'
11 .' of the "new hottness". If you are using DB2 on AS-400 please get'
12 .' in contact with the developer team:'
13 .' http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT'
14 ."\n"
15;
16
17# FIXME
18# Most likely all of this code is redundant and unnecessary. We should
19# be able to simply use base qw/DBIx::Class::Storage::DBI::DB2/;
20# Unfortunately nobody has an RDBMS engine to test with, so keeping
21# things as-is for the time being
22
d4f16b21 23sub _dbh_last_insert_id {
24 my ($self, $dbh, $source, $col) = @_;
d23f094e 25
d4f16b21 26 # get the schema/table separator:
27 # '.' when SQL naming is active
28 # '/' when system naming is active
29 my $sep = $dbh->get_info(41);
30 my $sth = $dbh->prepare_cached(
31 "SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM${sep}SYSDUMMY1", {}, 3);
32 $sth->execute();
d23f094e 33
d4f16b21 34 my @res = $sth->fetchrow_array();
d23f094e 35
d4f16b21 36 return @res ? $res[0] : undef;
d23f094e 37}
38
32a46300 39sub _sql_maker_opts {
f1f56aad 40 my ($self) = @_;
d4daee7b 41
a9f32dbc 42 $self->dbh_do(sub {
d4f16b21 43 my ($self, $dbh) = @_;
44
45 return {
46 limit_dialect => 'FetchFirst',
47 name_sep => $dbh->get_info(41)
48 };
a9f32dbc 49 });
f1f56aad 50}
51
d23f094e 521;
53
54=head1 NAME
55
f1f56aad 56DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL - Support specific to DB2/400
d23f094e 57over ODBC
58
59=head1 SYNOPSIS
60
d88ecca6 61 # In your result (table) classes
62 use base 'DBIx::Class::Core';
d23f094e 63 __PACKAGE__->set_primary_key('id');
64
d23f094e 65
66=head1 DESCRIPTION
67
f1f56aad 68This class implements support specific to DB2/400 over ODBC, including
69auto-increment primary keys, SQL::Abstract::Limit dialect, and name separator
32a46300 70for connections using either SQL naming or System naming.
d23f094e 71
72
73=head1 AUTHORS
74
c1e64353 75Marc Mims C<< <marc@questright.com> >>
d23f094e 76
aa8b8190 77Based on DBIx::Class::Storage::DBI::DB2 by Jess Robinson.
78
d23f094e 79=head1 LICENSE
80
81You may distribute this code under the same terms as Perl itself.
82
83=cut