From: Jess Robinson Date: Fri, 15 Sep 2006 21:17:43 +0000 (+0000) Subject: Fixup limit syntax finding for DB2 X-Git-Tag: v0.07003~38 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=758272ec2d8eeefba1641b7d5e59f08c96c9738d;p=dbsrgits%2FDBIx-Class.git Fixup limit syntax finding for DB2 --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 71c14aa..cb61070 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -52,9 +52,11 @@ WHERE ROW_NUM BETWEEN $offset AND $last # 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) = @_; - my $dbhname = ref $syntax eq 'HASH' ? $syntax->{Driver}{Name} : ''; + my $dbhname = blessed($syntax) ? $syntax->{Driver}{Name} : $syntax; +# print STDERR "Found DBH $syntax >$dbhname< ", $syntax->{Driver}->{Name}, "\n"; if(ref($self) && $dbhname && $dbhname eq 'DB2') { return 'RowNumberOver'; } @@ -777,7 +779,7 @@ sub _execute { $self->throw_exception("'$sql' did not generate a statement."); } if ($self->debug) { - my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind; + my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind; $self->debugobj->query_end($sql, @debug_bind); } return (wantarray ? ($rv, $sth, @bind) : $rv);