This atrocity will be removed from sqla, do not use here either
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLMaker / Oracle.pm
index f526e99..d144113 100644 (file)
@@ -20,7 +20,7 @@ sub new {
     handler => '_where_field_PRIOR',
   };
 
-  $self->SUPER::new (\%opts);
+  $self->next::method(\%opts);
 }
 
 sub _assemble_binds {
@@ -36,7 +36,7 @@ sub _parse_rs_attrs {
     my ($cb_sql, @cb_bind) = $self->_connect_by($rs_attrs);
     push @{$self->{oracle_connect_by_bind}}, @cb_bind;
 
-    my $sql = $self->SUPER::_parse_rs_attrs(@_);
+    my $sql = $self->next::method(@_);
 
     return "$cb_sql $sql";
 }
@@ -75,13 +75,13 @@ sub _order_siblings_by {
 
     my ( @sql, @bind );
     for my $c ( $self->_order_by_chunks($arg) ) {
-        $self->_SWITCH_refkind(
-            $c,
-            {
-                SCALAR   => sub { push @sql, $c },
-                ARRAYREF => sub { push @sql, shift @$c; push @bind, @$c },
-            }
-        );
+        if (ref $c) {
+            push @sql, shift @$c;
+            push @bind, @$c;
+        }
+        else {
+            push @sql, $c;
+        }
     }
 
     my $sql =
@@ -210,20 +210,29 @@ sub _insert_returning {
 
   my $f = $options->{returning};
 
-  my ($f_list, @f_names) = $self->_SWITCH_refkind($f, {
-    ARRAYREF => sub {
-      (join ', ', map { $self->_quote($_) } @$f),
-      @$f
-    },
-    SCALAR => sub {
-      $self->_quote($f),
-      $f,
-    },
-    SCALARREF => sub {
-      $$f,
-      $$f,
-    },
-  });
+  my ($f_list, @f_names) = do {
+    if (! ref $f) {
+      (
+        $self->_quote($f),
+        $f,
+      )
+    }
+    elsif (ref $f eq 'ARRAY') {
+      (
+        (join ', ', map { $self->_quote($_) } @$f),
+        @$f,
+      )
+    }
+    elsif (ref $f eq 'SCALAR') {
+      (
+        $$f,
+        $$f,
+      )
+    }
+    else {
+      $self->throw_exception("Unsupported INSERT RETURNING option $f");
+    }
+  };
 
   my $rc_ref = $options->{returning_container}
     or $self->throw_exception('No returning container supplied for IR values');