[Bast-commits] r9432 - in DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class: SQLAHacks Storage/DBI

abraxxa at dev.catalyst.perl.org abraxxa at dev.catalyst.perl.org
Tue May 25 16:39:26 GMT 2010


Author: abraxxa
Date: 2010-05-25 17:39:26 +0100 (Tue, 25 May 2010)
New Revision: 9432

Added:
   DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/SQLAHacks/Oracle.pm
Modified:
   DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/Storage/DBI/Oracle.pm
Log:
added SQLAHacks::Oracle and use it as default sqlmaker for Oracle


Added: DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/SQLAHacks/Oracle.pm
===================================================================
--- DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/SQLAHacks/Oracle.pm	                        (rev 0)
+++ DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/SQLAHacks/Oracle.pm	2010-05-25 16:39:26 UTC (rev 9432)
@@ -0,0 +1,21 @@
+package # Hide from PAUSE
+  DBIx::Class::SQLAHacks::Oracle;
+
+use base qw( DBIx::Class::SQLAHacks );
+use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/;
+
+#
+# Oracle has a different INSERT...RETURNING syntax
+#
+sub _insert_returning {
+    my ($self, $fields) = @_;
+
+    my $f = $self->_SWITCH_refkind($fields, {
+        ARRAYREF     => sub {join ', ', map { $self->_quote($_) } @$fields;},
+        SCALAR       => sub {$self->_quote($fields)},
+        SCALARREF    => sub {$$fields},
+    });
+    return join (' ', $self->_sqlcase(' returning'), $f, $self->_sqlcase('into'), ":$f");
+}
+
+1;

Modified: DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/Storage/DBI/Oracle.pm
===================================================================
--- DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/Storage/DBI/Oracle.pm	2010-05-25 16:13:27 UTC (rev 9431)
+++ DBIx-Class/0.08/branches/oracle_returning/lib/DBIx/Class/Storage/DBI/Oracle.pm	2010-05-25 16:39:26 UTC (rev 9432)
@@ -6,6 +6,8 @@
 use base qw/DBIx::Class::Storage::DBI/;
 use mro 'c3';
 
+__PACKAGE__->sql_maker_class('DBIx::Class::SQLAHacks::Oracle');
+
 sub _rebless {
     my ($self) = @_;
     




More information about the Bast-commits mailing list