[Dbix-class] Revised: Correctly use sequences in Oracle

Bill Boulden billb at seevast.com
Wed Dec 26 18:06:36 GMT 2007


Previous email did not make it through due to HTMLeyness.  Apologies, I
am new to these mailing lists.  Anyway:

The following code solves an issue where (with Oracle) giving a column
definition an auto-incrementing sequence would die on the first insert
operation.

 

$ svn diff
Index: lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- lib/DBIx/Class/Storage/DBI.pm       (revision 3901)
+++ lib/DBIx/Class/Storage/DBI.pm       (working copy)
@@ -1024,6 +1024,7 @@
       my $col_info = $source->column_info($col);
 
       if ( $col_info->{auto_nextval} ) {
+        $self->ensure_connected;
         $to_insert->{$col} = $self->_sequence_fetch( 'nextval',
$col_info->{sequence} || $self->_dbh_get_autoinc_seq($self->dbh,
$source) );
       }
     }

 	 
Bill Boulden
Developer
P: 716.817.5024
F: 716.636.6224
E: billb at seevast.com
www.seevast.com



More information about the DBIx-Class mailing list