Re: Discrepancies in docs and implementation
[prev]
[thread]
[next]
[Date index for 2004/10/24]
On Fri, Oct 08, 2004 at 04:45:20PM -0400, Kingsley Kerce wrote:
> Regarding the update method, the docs say:
> If any columns have been updated then the "after_update" trigger is
> invoked after the database update has executed and is passed: ($self,
> discard_columns => \@discard_columns, rows => $rows)
> (where rows is the return value from the DBI execute() method).
> but the code reads:
> $self->call_trigger('after_update', discard_columns => \@changed_cols);
> "rows" isn't being passed along.
Good catch. For now I'm just going to fix the docs. Code patches are
welcome...
> Also, the docs say:
> The update() method returns the number of rows updated, which should
> always be 1, or else -1 if no update was needed. ...
> but the code reads:
> return 1 unless my @changed_cols = $self->is_changed;
> It should be:
> return -1 unless my @changed_cols = $self->is_changed;
Applied.
> The update() method returns the number of rows updated, which should
> always be 1, or else -1 if no set accessors have been used since
> the last update().
I've changed this to:
The update() method returns the number of rows updated. If the object had
not changed and did not to issue an UPDATE statement, we return -1. If
the record in the database has been deleted, or its primary key value
changed, then the update will not affect any records and so the update()
method will return 0.
Thanks,
Tony
|
|
Re: Discrepancies in docs and implementation
Tony Bowden 14:17 on 24 Oct 2004
|