[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What code should be allowed to $dbh->commit(); ?
- Subject: What code should be allowed to $dbh->commit(); ?
- From: Erik Huelsmann <..hidden..>
- Date: Sun, 25 Mar 2012 10:48:37 +0200
This weekend I'm using the import_cvs functionality I've created in a real life situation (so far I had only tested it) to import a CoA setup.
What happened is that the csv file has encoding issues (not UTF-8). When I tried uploading again, I found that half the CoA was already in the system, while I had hoped that the failure would have caused the entire transaction be be aborted.
Turns out the save() method of the DBObject::Account class commits after inserting every account.
In my view, it's impractical to have library code issue commits. So, with this mail I'm soliciting feedback how people think about it. In my view, only the request handlers (ie 'top level code') should be issuing $dbh->commit()s.
Let's set a policy here which we can apply throughout "new code".