use min dbms_version for ::Replicated
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLAHacks.pm
index d2cd569..4da469e 100644 (file)
@@ -362,9 +362,8 @@ sub insert {
   if (! $_[0] or (ref $_[0] eq 'HASH' and !keys %{$_[0]} ) ) {
     my $sql = "INSERT INTO ${table} DEFAULT VALUES";
 
-    if (my @returning = @{ ($_[1]||{})->{returning} || [] }) {
-      $sql .= ' RETURNING (' . (join ', ' => map $self->_quote($_), @returning)
-            . ')';
+    if (my $ret = ($_[1]||{})->{returning} ) {
+      $sql .= $self->_insert_returning ($ret);
     }
 
     return $sql;
@@ -510,6 +509,14 @@ sub _table {
   }
 }
 
+sub _generate_join_clause {
+    my ($self, $join_type) = @_;
+
+    return sprintf ('%s JOIN ',
+      $join_type ?  ' ' . uc($join_type) : ''
+    );
+}
+
 sub _recurse_from {
   my ($self, $from, @join) = @_;
   my @sqlf;
@@ -528,10 +535,7 @@ sub _recurse_from {
 
     $join_type = $self->{_default_jointype} if not defined $join_type;
 
-    my $join_clause = sprintf ('%s JOIN ',
-      $join_type ?  ' ' . uc($join_type) : ''
-    );
-    push @sqlf, $join_clause;
+    push @sqlf, $self->_generate_join_clause( $join_type );
 
     if (ref $to eq 'ARRAY') {
       push(@sqlf, '(', $self->_recurse_from(@$to), ')');