Clear up some legacy cruft and straighten inheritance
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / NoBindVars.pm
index 43837e1..32908ee 100644 (file)
@@ -1,21 +1,21 @@
 package DBIx::Class::Storage::DBI::Sybase::NoBindVars;
 
-use Class::C3;
 use base qw/
   DBIx::Class::Storage::DBI::NoBindVars
   DBIx::Class::Storage::DBI::Sybase
 /;
+use mro 'c3';
 use List::Util ();
 use Scalar::Util ();
 
-sub _rebless {
+sub _init {
   my $self = shift;
   $self->disable_sth_caching(1);
-  $self->insert_txn(0);
+  $self->_identity_method('@@IDENTITY');
+  $self->next::method (@_);
 }
 
-# this works when NOT using placeholders
-sub _fetch_identity_sql { 'SELECT @@IDENTITY' }
+sub _fetch_identity_sql { 'SELECT ' . $_[0]->_identity_method }
 
 my $number = sub { Scalar::Util::looks_like_number($_[0]) };
 
@@ -32,27 +32,23 @@ my %noquote = (
     numeric => $decimal,
 );
 
-sub should_quote_value {
+sub interpolate_unquoted {
   my $self = shift;
   my ($type, $value) = @_;
 
   return $self->next::method(@_) if not defined $value or not defined $type;
 
   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;
+    return 1 if $noquote{$key}->($value);
+  }
+  elsif ($self->is_datatype_numeric($type) && $number->($value)) {
+    return 1;
   }
-
-## try to guess based on value
-#  elsif (not $type) {
-#    return 0 if $number->($value) || $noquote->{money}->($value);
-#  }
 
   return $self->next::method(@_);
 }
 
-sub _prep_bind_value {
+sub _prep_interpolated_value {
   my ($self, $type, $value) = @_;
 
   if ($type =~ /money/i && defined $value) {