[Bast-commits] r3862 - in
DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage:
. DBI/Oracle
plu at dev.catalyst.perl.org
plu at dev.catalyst.perl.org
Wed Nov 7 17:19:14 GMT 2007
Author: plu
Date: 2007-11-07 17:19:10 +0000 (Wed, 07 Nov 2007)
New Revision: 3862
Modified:
DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
Log:
moved sequence relatied insert code from DBI::Oracle::Generic to DBI so it'll work for other storage engines too
Modified: DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-11-07 17:16:44 UTC (rev 3861)
+++ DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm 2007-11-07 17:19:10 UTC (rev 3862)
@@ -63,26 +63,6 @@
$self->throw_exception("Unable to find a sequence INSERT trigger on table '" . $source->name . "'.");
}
-=head2 insert
-
-Fetch nextval from sequence and handle insert statement.
-
-=cut
-
-sub insert {
- my ( $self, $source, $to_insert ) = @_;
- foreach my $col ( $source->columns ) {
- if ( !defined $to_insert->{$col} ) {
- my $col_info = $source->column_info($col);
-
- if ( $col_info->{auto_nextval} ) {
- $to_insert->{$col} = $self->_sequence_fetch( 'nextval', $col_info->{sequence} || $self->_dbh_get_autoinc_seq($self->dbh, $source) );
- }
- }
- }
- $self->next::method( $source, $to_insert );
-}
-
sub _sequence_fetch {
my ( $self, $type, $seq ) = @_;
my ($id) = $self->dbh->selectrow_array("SELECT ${seq}.${type} FROM DUAL");
Modified: DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI.pm 2007-11-07 17:16:44 UTC (rev 3861)
+++ DBIx-Class/0.08/branches/oracle_sequence/lib/DBIx/Class/Storage/DBI.pm 2007-11-07 17:19:10 UTC (rev 3862)
@@ -1019,6 +1019,16 @@
my $ident = $source->from;
my $bind_attributes = $self->source_bind_attributes($source);
+ foreach my $col ( $source->columns ) {
+ if ( !defined $to_insert->{$col} ) {
+ my $col_info = $source->column_info($col);
+
+ if ( $col_info->{auto_nextval} ) {
+ $to_insert->{$col} = $self->_sequence_fetch( 'nextval', $col_info->{sequence} || $self->_dbh_get_autoinc_seq($self->dbh, $source) );
+ }
+ }
+ }
+
$self->_execute('insert' => [], $source, $bind_attributes, $to_insert);
return $to_insert;
More information about the Bast-commits
mailing list