X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=ebbf960542bd735d13d58c9f7cd9b5a79f752693;hb=2df1857d287a0481224caef360f29b9eeb1421ae;hp=1da92f4b781183507400477919f9c43a866f23cb;hpb=c13002976e32b818eabc3a8eaf6fa2e23ebed7e9;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 1da92f4..ebbf960 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -250,9 +250,9 @@ sequence, if you do not use a trigger to get the nextval, you have to set the L value as well. Also set this for MSSQL columns with the 'uniqueidentifier' -L whose values you want to automatically -generate using C, unless they are a primary key in which case this will -be done anyway. +L whose values you want to +automatically generate using C, unless they are a primary key in which +case this will be done anyway. =item extra @@ -465,10 +465,11 @@ called after L. Additionally, defines a L named C. -The primary key columns are used by L to -retrieve automatically created values from the database. They are also -used as default joining columns when specifying relationships, see -L. +Note: you normally do want to define a primary key on your sources +B. +See +L +for more info. =cut @@ -503,6 +504,16 @@ sub primary_columns { return @{shift->_primaries||[]}; } +sub _pri_cols { + my $self = shift; + my @pcols = $self->primary_columns + or $self->throw_exception (sprintf( + 'Operation requires a primary key to be declared on %s via set_primary_key', + ref $self, + )); + return @pcols; +} + =head2 add_unique_constraint =over 4