X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FSybase%2FNoBindVars.pm;h=9d5cac7261f2e1b1a2625aa9936f76ed11765cd3;hb=9b3dabe0c35b6dafdfec559d594e95d5131e84b5;hp=f3a46f6d7c3fb7f0c4d0a0acf6c7b9b121e2434a;hpb=8242035e7f824106e902a7667d0e82c4ec442b0b;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm index f3a46f6..9d5cac7 100644 --- a/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/Sybase/NoBindVars.pm @@ -8,6 +8,11 @@ use base qw/ use List::Util (); use Scalar::Util (); +sub _rebless { + my $self = shift; + $self->disable_sth_caching(1); +} + sub _dbh_last_insert_id { my ($self, $dbh, $source, $col) = @_; @@ -31,20 +36,22 @@ my %noquote = ( numeric => $decimal, ); -sub should_quote_data_type { +sub should_quote_value { my $self = shift; my ($type, $value) = @_; - return $self->next::method(@_) if not defined $value; + return $self->next::method(@_) if not defined $value or not defined $type; -## this is the correct method, but we have no type yet -# if (my $key = List::Util::first { $type =~ /$_/i } keys %noquote) { -# return 0 if $noquote{$key}->($value); -# } + if (my $key = List::Util::first { $type =~ /$_/i } keys %noquote) { + return 0 if $noquote{$key}->($value); + } elsif($self->is_datatype_numeric($type) && $number->($value)) { + return 0; + } -# temporary hack - return 0 if Scalar::Util::looks_like_number($value) || - ($value =~ /^\$(\S*)\z/ && Scalar::Util::looks_like_number($1)); +## try to guess based on value +# elsif (not $type) { +# return 0 if $number->($value) || $noquote->{money}->($value); +# } return $self->next::method(@_); }