Re: Class::DBI 1.00 (almost)

[prev] [thread] [next] [Date index for 2005/06/23]

From: Tim Bunce
Subject: Re: Class::DBI 1.00 (almost)
Date: 11:44 on 23 Jun 2005
On Thu, Jun 23, 2005 at 10:24:46AM +0100, Tim Bunce wrote:
> On Wed, Jun 22, 2005 at 12:28:40PM -0700, Peter Speltz wrote:
> > --- Tim Bunce <Tim.Bunce@xxxxx.xxx> wrote:
> > 
> > > On Tue, Jun 21, 2005 at 12:34:37PM -0700, Peter Speltz wrote:
> > > > This does not seem like a big problem.  However maybe a different return
> > > code
> > > > would be nicer.  I do not recall a database ever dieing when i try to
> > > update a
> > > > row that is not there. 
> > > 
> > > Sure, and open(FH, $file) doesn't throw an exception if the file can't
> > > be opened. But neither are good examples.
> > > 
> > > If an application calls
> > > 
> > >  $obj->some_attribute($new_value);
> > >  $obj->update;
> > > 
> > > I'd *really* like to be told that the update method couldn't actually
> > > update the record because it had vanished (or the application had
> > > messed with the primary key values).
> > > 
> > > > 1 -- update successful
> > > > 0 -- row inexistent or database error
> > > > -1-- no changes 
> > > 
> > > Few people are going to check the return code.
> > 
> > Whats the difference in checking a return code or checking $@ ? BTW I had in
> > mind if a 
> > return code of 0 was returned there would also be an explanation why like in
> > $c->update_error.  I was just following the 
> > theme of CDBI being a DB Recordset interface rather than an 00 system. 
> > 
> > > Class::DBI throws exceptions for many kinds of exceptional conditions.
> > > Applications written using Class::DBI should all have exception
> > > handling code already.
> > > 
> > > The row being deleted from the database and the application then trying
> > > to update that row is an exceptional condition. Throwing an exception
> > > (trivially ignorable via eval { $obj->update }, if you really want to)
> > > seems an entirely appropriate thing to do.
> > > 
> > 
> > Well let us see:  either you care that this exception occured or you do not. 
> > With the dieing behavior
> > then code is like: 
> > Case1 : you care -- eval {$c->update}; if ($@) {...}
> > Case2 : no care  -- eval {$c->update};
> 
> You're presuming that the eval would be wrapped tightly around the
> update. Typically it would be at a higher level in the code to catch
> exceptional conditions like this one.
> 
> > Now with a different return code:
> > Case1 : you care -- $c->update; if ($c->update_error) {...}
> > Case2 : no care  -- $c->update; 
> > 
> > I like the second way. No need for evals. If you care to handle the error you
> > look it up either way.
> 
> You've missed one:
> 
> Case3 : you would care if you knew about the issue but you don't
> 
> 	$c->update;

That example does, of course, apply equally to both the exception and
the return code cases, and requires no application code changes at all.

Naturally I believe the majority of users/applications fall into Case3.

Anyway, there's probably no point in us to-ing and fro-ing more without
input from Tony.

Tim.

(message missing)

Class::DBI 1.00 (almost)
Tony Bowden 12:57 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Will Hawes 14:56 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 15:15 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Will Hawes 15:50 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 18:56 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Matt S Trout 16:39 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Andy Grundman 16:41 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 18:58 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 19:34 on 21 Jun 2005

Re: Class::DBI 1.00 (almost)
Tim Bunce 23:17 on 21 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 19:28 on 22 Jun 2005

Re: Class::DBI 1.00 (almost)
Tim Bunce 09:24 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Tim Bunce 11:44 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 13:06 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Michael Peters 13:49 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 15:24 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 17:48 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 18:59 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 20:48 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 18:05 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 19:04 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 19:12 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 02:15 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:07 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Michael G Schwern 20:33 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 22:43 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 23:14 on 18 Jun 2005

Re: Class::DBI 1.00 (almost)
Rhesa Rozendaal 00:06 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:49 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Michael G Schwern 03:22 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:46 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 04:49 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:49 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
William Ross 03:55 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
William Ross 19:22 on 21 Jun 2005

Re: Class::DBI 1.00 (almost)
Brad Bowman 09:23 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 13:48 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Peter Speltz 14:31 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 15:25 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 18:21 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 18:38 on 19 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 03:52 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Michael G Schwern 04:16 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 04:21 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 04:50 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 04:59 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:26 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 16:35 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 16:50 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 10:08 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 10:47 on 20 Jun 2005

->create or ->insert (was: Class::DBI 1.00 (almost))
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 20:14 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 15:03 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Charles Bailey 15:18 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 15:30 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Charles Bailey 17:28 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 18:17 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 11:40 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 12:45 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 13:33 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 13:39 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Michael Peters 13:34 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
William Ross 14:04 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 14:27 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Perrin Harkins 14:42 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 14:03 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Cees Hek 14:13 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 14:15 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 14:55 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
merlyn (Randal L. Schwartz) 15:42 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 15:56 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 17:11 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 17:38 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Matt S Trout 18:00 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Edward J. Sabol 18:16 on 20 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 17:40 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:11 on 24 Jun 2005

Re: Class::DBI 1.00 (almost)
Tim Bunce 10:03 on 24 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 10:23 on 24 Jun 2005

Re: Class::DBI 1.00 (almost)
Tim Bunce 00:08 on 25 Jun 2005

Class::DBI 1.00 (almost)
Hartmaier Alexander 17:45 on 20 Jun 2005

Re: Class::DBI 1.00 (almost)
Andy Grundman 23:49 on 21 Jun 2005

Re: Class::DBI 1.00 (almost)
Hartmaier Alexander 13:26 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 14:09 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Hartmaier Alexander 14:27 on 23 Jun 2005

RE: Class::DBI 1.00 (almost)
Andrew O'Brien 23:12 on 23 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 07:43 on 24 Jun 2005

Re: Class::DBI 1.00 (almost)
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 07:48 on 24 Jun 2005

RE: Class::DBI 1.00 (almost)
Andrew O'Brien 07:53 on 24 Jun 2005

Re: Class::DBI 1.00 (almost)
Tony Bowden 08:00 on 24 Jun 2005

Generated at 16:36 on 28 Jul 2005 by mariachi v0.52