On Mon, 25 Jun 2001 07:42:39 -0500, Paul DuBois <[EMAIL PROTECTED]> wrote:
Paul,
appreciate the feedback, but my question wasn't in reference to the actual
coding and how it's used, this I understand, I was referring to when a
transaction is best used, in what type of a scenario. ;)
TIA
>>At 3:40 PM +0400 6/25/01, Ilya Martynov wrote:
>>> > Hello All,
>>>> I'm current working on project, converting a flatfile system, to use MySQL,
>>>> which supports transactions w/Innobase tables. My questions is, as
>>>>I'm sure many
>>>> have coded using transaction w/Perl and DBI. I understand that there as some
>>>> draw backs to using transactions when not necessary, but very
>>>>beneficial, when
>>>> needed. What are some good guide lines or "rule of thumb" to following when
>>>> using transactions type tables?
>>>
>>>This is from 'man DBI'. I don't think I can add anything to it:
>>
>>There was some discussion on the DBI list recently on this topic that
>>indicated that under some conditions having PrintError enabled could
>>result in the transaction being committed when an error occurred. I
>>haven't observed that to happen myself, but to avoid the problem,
>>it may be prudent to add this to the two lines preceding the eval:
>>
>>$dbh->{PrintError} = 0;
>>
>>
>>>
>>> The recommended way to implement robust transactions in
>>> Perl applications is to use `RaiseError' and
>>> `eval { ... }' (which is very fast, unlike `eval "..."').
>>> For example:
>>>
>>> $dbh->{AutoCommit} = 0; # enable transactions, if possible
>>> $dbh->{RaiseError} = 1;
>>> eval {
>>> foo(...) # do lots of work here
>>> bar(...) # including inserts
>>> baz(...) # and updates
>>> $dbh->commit; # commit the changes if we get this far
>>> };
>>> if ($@) {
>>> warn "Transaction aborted because $@";
>>> $dbh->rollback; # undo the incomplete changes
>>> # add other application on-error-clean-up code here
>>> }
>>>
>>>--
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>>>| Ilya Martynov (http://martynov.org/) |
>>>| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
>>>| AGAVA Software Company (http://www.agava.com/) |
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Mike(mickalo)Blezien
========================================
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225) 686-2002
=========================================
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php