From: Peter Rabbitson Date: Sun, 12 Sep 2010 18:52:49 +0000 (+0200) Subject: Cleanup Row::sequence() X-Git-Tag: v0.08125~69 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89170201e8ff8c60fab401b4b2e60f0fa13a3c47;p=dbsrgits%2FDBIx-Class.git Cleanup Row::sequence() While it seems like a rather useless method these days (we have excellent sequence detection) keep it around nevertheless. However move it to ResultSource where it logically belongs, and undocument its use from a couple of ::Storage driver POD examples --- diff --git a/lib/DBIx/Class/PK/Auto.pm b/lib/DBIx/Class/PK/Auto.pm index e2f717f..523ec27 100644 --- a/lib/DBIx/Class/PK/Auto.pm +++ b/lib/DBIx/Class/PK/Auto.pm @@ -5,6 +5,8 @@ use base qw/DBIx::Class/; use strict; use warnings; +1; + =head1 NAME DBIx::Class::PK::Auto - Automatic primary key class @@ -36,19 +38,8 @@ The code that was handled here is now in Row for efficiency. =head2 sequence -Manually define the correct sequence for your table, to avoid the overhead -associated with looking up the sequence automatically. - -=cut - -sub sequence { - my ($self,$seq) = @_; - foreach my $pri ($self->primary_columns) { - $self->column_info($pri)->{sequence} = $seq; - } -} - -1; +The code that was handled here is now in ResultSource, and is being proxied to +Row as well. =head1 AUTHORS diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 075c331..824e6d6 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -537,6 +537,30 @@ sub _pri_cols { return @pcols; } +=head2 sequence + +Manually define the correct sequence for your table, to avoid the overhead +associated with looking up the sequence automatically. The supplied sequence +will be applied to the L of each L + +=over 4 + +=item Arguments: $sequence_name + +=item Return value: undefined + +=back + +=cut + +sub sequence { + my ($self,$seq) = @_; + foreach my $pri ($self->primary_columns) { + $self->column_info($pri)->{sequence} = $seq; + } +} + + =head2 add_unique_constraint =over 4 diff --git a/lib/DBIx/Class/ResultSourceProxy.pm b/lib/DBIx/Class/ResultSourceProxy.pm index 859b397..dcbc276 100644 --- a/lib/DBIx/Class/ResultSourceProxy.pm +++ b/lib/DBIx/Class/ResultSourceProxy.pm @@ -67,6 +67,7 @@ for my $method_to_proxy (qw/ set_primary_key primary_columns _pri_cols + sequence add_unique_constraint add_unique_constraints diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index be48f20..40156b6 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -19,7 +19,6 @@ DBIx::Class::Storage::DBI::Oracle::Generic - Oracle Support for DBIx::Class use base 'DBIx::Class::Core'; __PACKAGE__->add_columns({ id => { sequence => 'mysequence', auto_nextval => 1 } }); __PACKAGE__->set_primary_key('id'); - __PACKAGE__->sequence('mysequence'); # Somewhere in your Code # add some data to a table with a hierarchical relationship diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 36c9c42..e5eaff2 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -229,7 +229,6 @@ DBIx::Class::Storage::DBI::Pg - Automatic primary key class for PostgreSQL # In your result (table) classes use base 'DBIx::Class::Core'; __PACKAGE__->set_primary_key('id'); - __PACKAGE__->sequence('mysequence'); =head1 DESCRIPTION