Hi,

thanks to mst who posted yesterday a few lines of code:

2007-09-05 19:31:40 <@mst> sub insert { my ($self, $source, $to_insert) = @_; foreach my $pri ($source->primary_columns) { if (! defined $to_insert->{$pri}) { my $col_info = $source->column_info ($pri); if ($col_info->{auto_nextval}) { $to_insert->{$pri} = $self- >_sequence_fetch('nextval',$col_info->{sequence}); } } $self- >next::method($source, $to_insert); } 2007-09-05 19:32:44 <@mst> sub _sequence_fetch { my ($self, $type, $seq) = @_; $self->_dbh_do("SELECT ${seq}.${type} FROM DUAL"); }

So now here's the patch with some test *attached*
What does it do? You can use oracle & dbic with an autoincremental sequence WITHOUT using an oracle trigger. So finally ".. insert a row with a primary key that uses a sequence?" from DBIx::Class::Manual::FAQ works :)

Kind regards,
plu

Attachment: oracle_sequence.patch
Description: Binary data


--
Johannes Plunien | mailto:[EMAIL PROTECTED] | http://www.pqpq.de


_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to