From: Marc Mims Date: Tue, 9 May 2006 00:02:54 +0000 (+0000) Subject: - Factored out sql_maker arguments so they can be customized by derived X-Git-Tag: v0.07002~75^2~208 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f1f56aad66c46b1f6bb7a4424cdfd95529b82003;p=dbsrgits%2FDBIx-Class.git - Factored out sql_maker arguments so they can be customized by derived ::Storage::DBI::* modules. - Customized sql_maker arguments for DB2/400 over ODBC. --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index aad0353..797074b 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -378,10 +378,16 @@ sub dbh { return $self->_dbh; } +sub _sql_maker_args { + my ($self) = @_; + + return ( limit_dialect => $self->dbh ); +} + sub sql_maker { my ($self) = @_; unless ($self->_sql_maker) { - $self->_sql_maker(new DBIC::SQL::Abstract( limit_dialect => $self->dbh )); + $self->_sql_maker(new DBIC::SQL::Abstract( $self->_sql_maker_args )); } return $self->_sql_maker; } diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm b/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm index cba274a..d4e6218 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm @@ -23,11 +23,20 @@ sub last_insert_id return @res ? $res[0] : undef; } +sub _sql_maker_args { + my ($self) = @_; + + return ( + limit_dialect => 'FetchFirst', + name_sep => $self->_dbh->get_info(41) + ); +} + 1; =head1 NAME -DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL - Automatic primary key class for DB2/400 +DBIx::Class::Storage::DBI::ODBC::DB2_400_SQL - Support specific to DB2/400 over ODBC =head1 SYNOPSIS @@ -39,7 +48,9 @@ over ODBC =head1 DESCRIPTION -This class implements autoincrements for DB2/400 over ODBC. +This class implements support specific to DB2/400 over ODBC, including +auto-increment primary keys, SQL::Abstract::Limit dialect, and name separator +for for connections using either SQL naming or System naming. =head1 AUTHORS