From: Rafael Kitover Date: Wed, 10 Jun 2009 16:17:31 +0000 (+0000) Subject: cache rsrc properly in NoBindVars, return undef if no rsrc X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbdc039bb73622702cbaaa25890349e3f2664fbf;p=dbsrgits%2FDBIx-Class-Historic.git cache rsrc properly in NoBindVars, return undef if no rsrc --- diff --git a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm index 0c1a083..3256846 100644 --- a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm @@ -62,8 +62,7 @@ sub _prep_for_execute { my $rsrc = $alias2src->{$alias}; - my $datatype = $rsrc ? $rsrc->column_info($col)->{data_type} : - '__UNKNOWN__'; + my $datatype = $rsrc && $rsrc->column_info($col)->{data_type}; foreach my $data (@$bound) { if(ref $data) { diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm index 42c9018..d0fea5e 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm @@ -37,9 +37,11 @@ sub should_quote_data_type { return $self->next::method(@_) if not defined $value; + $type ||= ''; + if (my $key = List::Util::first { $type =~ /$_/i } keys %noquote) { return 0 if $noquote{$key}->($value); - } elsif ($type eq '__UNKNOWN__') { + } elsif (not $type) { # try to guess based on value return 0 if $number->($value) || $noquote->{money}->($value); }