Fix multiple storage regressions from 52416317
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI / Sybase / ASE.pm
index 80d7913..d2f5e2f 100644 (file)
@@ -16,6 +16,8 @@ use Data::Dumper::Concise 'Dumper';
 use Try::Tiny;
 use namespace::clean;
 
+__PACKAGE__->sql_limit_dialect ('RowCountOrGenericSubQ');
+
 __PACKAGE__->mk_group_accessors('simple' =>
     qw/_identity _blob_log_on_update _writer_storage _is_extra_storage
        _bulk_storage _is_bulk_storage _began_bulk_work
@@ -83,8 +85,8 @@ To turn off this warning set the DBIC_SYBASE_FREETDS_NOWARN environment
 variable.
 EOF
 
-    if (not $self->_typeless_placeholders_supported) {
-      if ($self->_placeholders_supported) {
+    if (not $self->_use_typeless_placeholders) {
+      if ($self->_use_placeholders) {
         $self->auto_cast(1);
       }
       else {
@@ -102,7 +104,7 @@ EOF
     $self->_rebless;
   }
   # this is highly unlikely, but we check just in case
-  elsif (not $self->_typeless_placeholders_supported) {
+  elsif (not $self->_use_typeless_placeholders) {
     $self->auto_cast(1);
   }
 }
@@ -258,9 +260,13 @@ sub _prep_for_execute {
     first { $bind_info->{$_}{is_auto_increment} }
     keys %$bind_info
   ;
+
+  my $columns_info = blessed $ident && $ident->columns_info;
+
   my $identity_col =
-    blessed $ident &&
-    first { $ident->column_info($_)->{is_auto_increment} } $ident->columns
+    $columns_info &&
+    first { $columns_info->{$_}{is_auto_increment} }
+      keys %$columns_info
   ;
 
   if (($op eq 'insert' && $bound_identity_col) ||
@@ -348,8 +354,11 @@ sub insert {
   my $self = shift;
   my ($source, $to_insert) = @_;
 
+  my $columns_info = $source->columns_info;
+
   my $identity_col =
-    (first { $source->column_info($_)->{is_auto_increment} } $source->columns)
+    (first { $columns_info->{$_}{is_auto_increment} }
+      keys %$columns_info )
     || '';
 
   # check for empty insert
@@ -433,8 +442,11 @@ sub update {
 
   my $table = $source->name;
 
+  my $columns_info = $source->columns_info;
+
   my $identity_col =
-    first { $source->column_info($_)->{is_auto_increment} } $source->columns;
+    first { $columns_info->{$_}{is_auto_increment} }
+      keys %$columns_info;
 
   my $is_identity_update = $identity_col && defined $fields->{$identity_col};
 
@@ -483,8 +495,11 @@ sub insert_bulk {
   my $self = shift;
   my ($source, $cols, $data) = @_;
 
+  my $columns_info = $source->columns_info;
+
   my $identity_col =
-    first { $source->column_info($_)->{is_auto_increment} } $source->columns;
+    first { $columns_info->{$_}{is_auto_increment} }
+      keys %$columns_info;
 
   my $is_identity_insert = (first { $_ eq $identity_col } @{$cols}) ? 1 : 0;
 
@@ -1150,7 +1165,7 @@ Real limits and limited counts using stored procedures deployed on startup.
 
 =item *
 
-Adaptive Server Anywhere (ASA) support, with possible SQLA::Limit support.
+Adaptive Server Anywhere (ASA) support
 
 =item *