[Bast-commits] r6411 - in DBIx-Class/0.08/trunk/lib/DBIx/Class: .
Storage/DBI
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Mon May 25 07:42:46 GMT 2009
Author: ribasushi
Date: 2009-05-25 07:42:45 +0000 (Mon, 25 May 2009)
New Revision: 6411
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/DB2.pm
Log:
Move the DB2 Limit syntax setting into the storage class
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm 2009-05-25 06:48:38 UTC (rev 6410)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/SQLAHacks.pm 2009-05-25 07:42:45 UTC (rev 6411)
@@ -5,6 +5,7 @@
use strict;
use warnings;
use Carp::Clan qw/^DBIx::Class/;
+use Scalar::Util();
sub new {
my $self = shift->SUPER::new(@_);
@@ -97,21 +98,9 @@
# While we're at it, this should make LIMIT queries more efficient,
# without digging into things too deeply
-use Scalar::Util 'blessed';
sub _find_syntax {
my ($self, $syntax) = @_;
-
- # DB2 is the only remaining DB using this. Even though we are not sure if
- # RowNumberOver is still needed here (should be part of SQLA) leave the
- # code in place
- my $dbhname = blessed($syntax) ? $syntax->{Driver}{Name} : $syntax;
- if(ref($self) && $dbhname) {
- if ($dbhname eq 'DB2') {
- return 'RowNumberOver';
- }
- }
-
- $self->{_cached_syntax} ||= $self->SUPER::_find_syntax($syntax);
+ return $self->{_cached_syntax} ||= $self->SUPER::_find_syntax($syntax);
}
sub select {
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/DB2.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/DB2.pm 2009-05-25 06:48:38 UTC (rev 6410)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/DB2.pm 2009-05-25 07:42:45 UTC (rev 6411)
@@ -20,6 +20,16 @@
sub datetime_parser_type { "DateTime::Format::DB2"; }
+sub _sql_maker_opts {
+ my ( $self, $opts ) = @_;
+
+ if ( $opts ) {
+ $self->{_sql_maker_opts} = { %$opts };
+ }
+
+ return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} };
+}
+
1;
=head1 NAME
More information about the Bast-commits
mailing list