Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 62231
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: arc [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: 0.08124



Subject: [PATCH] DBIx::Class::Row->discard_changes documented twice
Download (untitled) / with headers
text/plain 274b
There are two documentation hunks in DBIx::Class::Row for the discard_changes method, with overlapping content. The attached patch merges the two together, preserving all content except for the (outdated) claim that the method is actually implemented in DBIx::Class::PK.
Subject: discard_changes_doc.diff
From 6a13c2ffa7f8e11fa705fc928b183265edf60788 Mon Sep 17 00:00:00 2001 From: Aaron Crane <arc@cpan.org> Date: Mon, 18 Oct 2010 13:20:25 +0100 Subject: Doc fix: DBIx::Class::Row->discard_changes documented twice --- lib/DBIx/Class/Row.pm | 56 +++++++++++++++++++----------------------------- 1 files changed, 22 insertions(+), 34 deletions(-) diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index e8a6b56..75cdc39 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -1371,20 +1371,36 @@ sub get_from_storage { return $resultset->find($ident_cond); } -=head2 discard_changes ($attrs) +=head2 discard_changes ($attrs?) + + $row->discard_changes + +=over + +=item Arguments: none or $attrs + +=item Returns: self (updates object in-place) + +=back Re-selects the row from the database, losing any changes that had -been made. Throws an exception if a proper WHERE clause identifying +been made. Throws an exception if a proper C<WHERE> clause identifying the database row can not be constructed (i.e. if the original object does not contain its entire -L<primary key|DBIx::Class::Manual::Intro/The Significance and Importance of Primary Keys> -). +L<primary key|DBIx::Class::Manual::Intro/The Significance and Importance of Primary Keys>). This method can also be used to refresh from storage, retrieving any changes made since the row was last read from storage. -$attrs is expected to be a hashref of attributes suitable for passing as the -second argument to $resultset->search($cond, $attrs); +$attrs, if supplied, is expected to be a hashref of attributes suitable for passing as the +second argument to C<< $resultset->search($cond, $attrs) >>; + +Note: If you are using L<DBIx::Class::Storage::DBI::Replicated> as your +storage, please kept in mind that if you L</discard_changes> on a row that you +just updated or created, you should wrap the entire bit inside a transaction. +Otherwise you run the risk that you insert or update to the master database +but read from a replicant database that has not yet been updated from the +master. This will result in unexpected results. =cut @@ -1445,34 +1461,6 @@ sub throw_exception { Returns the primary key(s) for a row. Can't be called as a class method. Actually implemented in L<DBIx::Class::PK> -=head2 discard_changes - - $row->discard_changes - -=over - -=item Arguments: none - -=item Returns: nothing (updates object in-place) - -=back - -Retrieves and sets the row object data from the database, losing any -local changes made. - -This method can also be used to refresh from storage, retrieving any -changes made since the row was last read from storage. Actually -implemented in L<DBIx::Class::PK> - -Note: If you are using L<DBIx::Class::Storage::DBI::Replicated> as your -storage, please kept in mind that if you L</discard_changes> on a row that you -just updated or created, you should wrap the entire bit inside a transaction. -Otherwise you run the risk that you insert or update to the master database -but read from a replicant database that has not yet been updated from the -master. This will result in unexpected results. - -=cut - 1; =head1 AUTHORS -- 1.7.3
Download (untitled) / with headers
text/plain 621b
On Mon Oct 18 08:41:10 2010, ARC wrote: Show quoted text
> There are two documentation hunks in DBIx::Class::Row for the > discard_changes method, with > overlapping content. The attached patch merges the two together, > preserving all content except > for the (outdated) claim that the method is actually implemented in > DBIx::Class::PK.
Applied, pending merge to master: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/DBIx-Class.git;a=commitdiff;h=8dedbaff6f3c8e91db05d252bf81fdc4980a5a12 May I suggest stopping by perl.irc.org#dbix-class so I set you up with a commit bit? Much faster than moving patches around. Thanks!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.