move Firebird ODBC override for RETURNING to a SQLAHacks class
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLAHacks / ODBC / Firebird.pm
1 package # Hide from PAUSE
2   DBIx::Class::SQLAHacks::ODBC::Firebird;
3
4 use strict;
5 use warnings;
6 use base qw( DBIx::Class::SQLAHacks );
7 use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
8
9 sub insert {
10   my $self = shift;
11   my ($table, $vals, $opts) = @_;
12
13 # Quoting RETURNING values breaks the Firebird ODBC driver, so we convert to
14 # scalarref with unquoted values.
15   my $returning = $opts->{returning};
16
17   if ($returning && ref $returning eq 'ARRAY') {
18     $opts->{returning} = \join ', ' => @$returning;
19   }
20
21   return $self->next::method(@_);
22 }
23
24 1;