[Bast-commits] r8570 - in
DBIx-Class/0.08/branches/storage-interbase: .
lib/DBIx/Class/SQLAHacks lib/DBIx/Class/SQLAHacks/ODBC
lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/ODBC
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sat Feb 6 12:35:32 GMT 2010
Author: caelum
Date: 2010-02-06 12:35:31 +0000 (Sat, 06 Feb 2010)
New Revision: 8570
Added:
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/SQLAHacks/ODBC/
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/SQLAHacks/ODBC/Firebird.pm
Modified:
DBIx-Class/0.08/branches/storage-interbase/Makefile.PL
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm
Log:
move Firebird ODBC override for RETURNING to a SQLAHacks class
Modified: DBIx-Class/0.08/branches/storage-interbase/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/Makefile.PL 2010-02-06 02:04:43 UTC (rev 8569)
+++ DBIx-Class/0.08/branches/storage-interbase/Makefile.PL 2010-02-06 12:35:31 UTC (rev 8570)
@@ -39,7 +39,7 @@
requires 'Module::Find' => '0.06';
requires 'Path::Class' => '0.16';
requires 'Scope::Guard' => '0.03';
-requires 'SQL::Abstract' => '1.60';
+requires 'SQL::Abstract' => '1.61';
requires 'SQL::Abstract::Limit' => '0.13';
requires 'Sub::Name' => '0.04';
requires 'Data::Dumper::Concise' => '1.000';
@@ -128,6 +128,11 @@
'DateTime::Format::Strptime' => 0,
) : ()
,
+ grep $_, @ENV{qw/DBICTEST_FIREBIRD_DSN DBICTEST_FIREBIRD_ODBC_DSN/}
+ ? (
+ 'DateTime::Format::Strptime' => 0,
+ ) : ()
+ ,
);
#************************************************************************#
# Make ABSOLUTELY SURE that nothing on the list above is a real require, #
Added: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/SQLAHacks/ODBC/Firebird.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/SQLAHacks/ODBC/Firebird.pm (rev 0)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/SQLAHacks/ODBC/Firebird.pm 2010-02-06 12:35:31 UTC (rev 8570)
@@ -0,0 +1,24 @@
+package # Hide from PAUSE
+ DBIx::Class::SQLAHacks::ODBC::Firebird;
+
+use strict;
+use warnings;
+use base qw( DBIx::Class::SQLAHacks );
+use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
+
+sub insert {
+ my $self = shift;
+ my ($table, $vals, $opts) = @_;
+
+# Quoting RETURNING values breaks the Firebird ODBC driver, so we convert to
+# scalarref with unquoted values.
+ my $returning = $opts->{returning};
+
+ if ($returning && ref $returning eq 'ARRAY') {
+ $opts->{returning} = \join ', ' => @$returning;
+ }
+
+ return $self->next::method(@_);
+}
+
+1;
Modified: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-06 02:04:43 UTC (rev 8569)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/InterBase.pm 2010-02-06 12:35:31 UTC (rev 8570)
@@ -16,8 +16,6 @@
my $self = shift;
my ($op, $extra_bind, $ident, $args) = @_;
- my ($sql, $bind) = $self->next::method (@_);
-
if ($op eq 'insert') {
my @pk = $ident->primary_columns;
my %pk;
@@ -36,26 +34,16 @@
} $ident->columns;
if (@auto_inc_cols) {
- my $auto_inc_cols =
- join ', ',
- map $self->_quote_column_for_returning($_), @auto_inc_cols;
+ $args->[1]{returning} = \@auto_inc_cols;
- $sql .= " RETURNING ($auto_inc_cols)";
-
$self->_auto_incs([]);
$self->_auto_incs->[0] = \@auto_inc_cols;
}
}
- return ($sql, $bind);
+ return $self->next::method(@_);
}
-sub _quote_column_for_returning {
- my ($self, $col) = @_;
-
- return $self->sql_maker->_quote($col);
-}
-
sub _execute {
my $self = shift;
my ($op) = @_;
Modified: DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm
===================================================================
--- DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm 2010-02-06 02:04:43 UTC (rev 8569)
+++ DBIx-Class/0.08/branches/storage-interbase/lib/DBIx/Class/Storage/DBI/ODBC/Firebird.pm 2010-02-06 12:35:31 UTC (rev 8570)
@@ -17,10 +17,7 @@
=cut
-# RETURNING ("foo") is broken in ODBC, but RETURNING (foo) works
-sub _quote_column_for_returning {
- return $_[1];
-}
+__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::ODBC::Firebird');
sub datetime_parser_type { __PACKAGE__ }
More information about the Bast-commits
mailing list