I've begun porting my db interaction code to a transaction based approach.

I have 2 db handles 'DBH' and 'DBH_Write' , each with their own name/pass

DBH is used exclusively for selects , DBH_Write is used for transactional locking for record creation

I've started getting a "Already in a transaction" error on my first use of the DBHwriter though, and i can't figure out how or why

i've set this:
$this->{'DBH_Write'}->{TraceLevel} = 14 ;
and i get this:
begin_work in DBD::_::db for DBD::mysql::db (Apache::DBI::db=HASH(0x1c +96d90)~0x1c99d48) thr#18d6200 >> FETCH DISPATCH (DBI::db=HASH(0x1c99d48) rc1/2 @2 g0 ima40 +4 pid#4399) at /Library/Perl/5.8.6/darwin-thread-multi-2level/DBI.pm +line 1630 via /webserver/sites/test.com/lib/Object/User.pm line 301 1 -> FETCH for DBD::mysql::db (DBI::db=HASH(0x1c99d48)~INNER 'AutoCo +mmit') thr#18d6200 1 <- FETCH= '' at /Library/Perl/5.8.6/darwin-thread-multi-2level/DBI +.pm line 1630 via /webserver/sites/test.com/lib/Object/User.pm line 3 +01 >> set_err DISPATCH (DBI::db=HASH(0x1c99d48) rc1/2 @3 g0 ima11 + pid#4399) at /Library/Perl/5.8.6/darwin-thread-multi-2level/DBI.pm l +ine 1630 via /webserver/sites/test.com/lib/Object/User.pm line 301 1 -> set_err in DBD::_::common for DBD::mysql::db (DBI::db=HASH(0x1c +99d48)~INNER 1 'Already in a transaction') thr#18d6200 !! ERROR: 1 'Already in a transaction' (err#1) 1 <- set_err= undef at /Library/Perl/5.8.6/darwin-thread-multi-2leve +l/DBI.pm line 1630 via /webserver/sites/test.com/lib/Object/User.pm l +ine 301 !! ERROR: 1 'Already in a transaction' (err#1) <- begin_work= undef at /webserver/sites/test.com/lib/Object/User. +pm line 301 via /webserver/sites/test.com/lib/Object/User.pm line 363 DBD::mysql::db begin_work failed: Already in a transaction at /webserv +er/sites/test.com/lib/Object/User.pm line 301.
the offending line in 301:
$_[0]->{'DBH_Write'}->begin_work
I've been tracing the mysql connection log, every call to the DB, this is the first time my code uses the DBH_Write handle. I've tried placing rollback and commit before that line, neither work.

can anyone offer insight?

In reply to odd transaction behavior: dbi mysql by nmerriweather

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.