sub perform_transaction {
my ($dbh, $coderef, $allow_non_transaction) = @_;
my $use_transaction = 1;
my $orig_AutoCommit = $dbh-{AutoCommit};
if ($orig_AutoCommit) {
unless (eval { $dbh-{AutoCommit} = 0; 1 }) {
sub perform_transaction {
my ($dbh, $coderef, $allow_non_transaction) = @_;
my $use_transaction = 1;
my $orig_AutoCommit = $dbh-{AutoCommit};
if ($orig_AutoCommit) {
unless (eval { $dbh-{AutoCommit} = 0; 1 }) {
On Wed, Mar 31, 2004 at 04:08:09PM +0100, Tim Bunce wrote:
sub perform_transaction {
my ($dbh, $coderef, $allow_non_transaction) = @_;
I suggest not taking any (non-coderef) arguments after $coderef, because
they can easily get lost visually:
While it would be neat to have such a capability (ie, adding transaction
monitor capability to DBI), in this present form, the docs will need to be very
explicit about
what its capabilities really are (Bold and UPPERCASE THE POD DESCRIPTION).
OTOH, might a partial xaction monitor
Incorporating feedback (thanks) and other ideas:
sub perform_transaction {
! my ($dbh, $attr, $coderef, @args) = @_;
my $wantarray = wantarray;
my $use_transaction = 1;
my $orig_AutoCommit = $dbh-{AutoCommit};
if ($orig_AutoCommit)
On Wed, Mar 31, 2004 at 10:20:16PM +0100, Tim Bunce wrote:
sub perform_transaction {
...
}
But as I tinker with it I wonder if it's a solution chasing a problem.
Where, and how, and why, would it be used?
Anyone got any realistic examples?
Well, yes, but it's 350 lines
On Mar 31, 2004, at 1:20 PM, Tim Bunce wrote:
+ $attr-{OnCommit}-() if $attr-{OnCommit}-();
I think you meant:
$attr-{OnCommit}-() if $attr-{OnCommit};
Regards,
David