Help for this page

Select Code to Download


  1. or download this
    $DBH->do("BEGIN");  #  explicitly start a new transaction
                        #  this overrides autocommit setting
    # ...
    $DBH->do("COMMIT");  #end transaction, this is the "expensive part" ti
    +mewise
    
  2. or download this
    my $dbh=DBI->connect('dbi:...', 'user', 'pass', { RaiseError => 1, Aut
    +oCommit => 1, ... });
    $dbh->begin_work(); # if this fails, you have tried to nest transactio
    +ns.
    ...
        eval { $dbh->rollback() };
    }
    # At this point, either all changes or no changes have happened in the
    + database.