On Fri, Sep 17, 2004 at 04:19:58PM +0200, Mathieu Roy wrote:
> Sylvain Beucler <[EMAIL PROTECTED]> tapota :
>
> > Function DeleteGroup() in Groups.pm returns the result of $dbd->do().
> >
> > This value is the number of rows returns, or -1 if that number is not available,
> > or undef on error.
> >
> > The number of row is a real number, eg 0E0, which means that any
> > number of row, including 0, is considered 'true' by Perl.
> >
> > This makes the DeleteGroup test in sv_register_discard to fail, so if
> > the group I want to delete does not exist, I am not warned.
> >
> > This can easily be fixed in sv_register_discard (test if <
> > 1). However, what is the precise signature of DeleteGroup? I think it
> > should return 0 (not 0E0) on error. However, maybe it should return
> > 0E0 for consistency with DeleteGroup*s*.
>
> I think the difference between DeleteGroup and DeleteGroups is the
> fact that the first take as argument and unix group name and the
> second a WHERE sql statement.
Exactly, for example:
* DeleteGroup($project)
* DeleteGroups("status='I'")
> But both of these subs should probably return false/0 in case of
> failure.
Actually, both functions are used only once, which eases documenting
the signature.
DeleteGroup is used by sv_register_discard, and I think it should be
fixed: 1/true = success, 0/false = SQL failure or no group deleted.
DeleteGroups is used by sv_cleaner, that interprets the return value
as the number of deleted groups. So I think the $dbd->do() return
value is fine (ie 0 matching rows is not a failure).
If this is too inconsistent (abeilt IMHO more intuitive) I can fix
sv_register_discard instead of Groups.pm. In either case I will
complete the functions documentation in Groups.pm.
What do you think?
--
Sylvain
_______________________________________________
Savane-dev mailing list
[EMAIL PROTECTED]
https://mail.gna.org/listinfo/savane-dev