From: Peter Rabbitson Date: Mon, 15 Mar 2010 13:55:14 +0000 (+0000) Subject: Proper fix for RETURNING with default insert X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef8d02eb7856f32ef1d738aba4923a167c6ed2df;p=dbsrgits%2FDBIx-Class-Historic.git Proper fix for RETURNING with default insert --- diff --git a/Makefile.PL b/Makefile.PL index 9d087b2..2889e84 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -45,7 +45,7 @@ my $runtime_requires = { 'MRO::Compat' => '0.09', 'Module::Find' => '0.06', 'Path::Class' => '0.18', - 'SQL::Abstract' => '1.61', + 'SQL::Abstract' => '1.62', 'SQL::Abstract::Limit' => '0.13', 'Sub::Name' => '0.04', 'Data::Dumper::Concise' => '1.000', diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index d2cd569..7c5d783 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -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;