[Catalyst] ->model-> return values?

leonard.a.jaffe at jpmchase.com leonard.a.jaffe at jpmchase.com
Mon Sep 25 18:53:57 CEST 2006


> Matt S Trout wrote:
> > If the DB throws an error on the statement you'll get an exception.
In DBI.pm the attribute that controls whether to throw a fit or fail 
quietly 
is RaiseError. It is set as an attribute, usually at connect() time. when 
set 
=> 1, DBI "raises" the error by throwing something.  You'll need eval() 
wrappers to work this way.  When RaiseError => 0, errors do not cause a 
thrown
exception, so you must check $DBI::err and/or $DBI::errstr for error codes 
and 
error messages respectively. Which you use will be determined by you 
affinity
for eval/$@.  The downside to RaiseError => 0 is that if you miss one, 
your app
ambles merrily along, and your data can get messed up, or your users will 
subsequently experience odd behaviors fro you app as Garbage In begets 
Garbage Out.

When working directly with DBI, I like RaiseError => 0 and PrintError => 1 

so the DBI errors get printed to STDERR, and therefore logged.
 


> If not I -think- you'll get number of rows affected, but not 100% sure 
without 
> looking. If you don't, prod the dbic list because I suspect that would 
count 
> as a bug.
update and delete return the number of affected rows from DBI, and BDIC 
passes 
this value to you, calling it "Storage dependent"


Len.

-- 
Len Jaffe
lenjaffe at jaffeystems.com


-----------------------------------------
This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law.  If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED.  Although this transmission and
any attachments are believed to be free of any virus or other
defect that might affect any computer system into which it is
received and opened, it is the responsibility of the recipient to
ensure that it is virus free and no responsibility is accepted by
JPMorgan Chase & Co., its subsidiaries and affiliates, as
applicable, for any loss or damage arising in any way from its use.
If you received this transmission in error, please immediately
contact the sender and destroy the material in its entirety,
whether in electronic or hard copy format. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060925/83e7f393/attachment-0001.htm 


More information about the Catalyst mailing list