Giter VIP home page Giter VIP logo

db-transaction's Introduction

NAME

DB::Transaction - feather-weight transaction management for your DBI handles

SYNOPSIS

use DB::Transaction qw(run_in_transaction);

my $dbh = My::Application->get_dbh;

run_in_transaction {
    $dbh->do('
        update risky_business -- in some fashion
    ');
} db_handle => $dbh, on_error => 'rollback';

DESCRIPTION

DB::Transaction provides one function: run_in_transaction

EXPORTS

By default, none. On request, run_in_transaction.

run_in_transaction BLOCK db_handle => $db_handle, on_error => ['rollback' | 'continue']

Begin a transaction on $db_handle, then run BLOCK. Any errors raised in the course of executing BLOCK will cause the current transaction to be handled according to your on_error specification.

on_error may be one of these two options:

  • rollback -- call this dbh's ->rollback method

  • continue -- just keep on chugging, man!

on_error => 'rollback' is the default behavior.

Transactions may be nested, though your underlying database may not support nested transactions. It's up to you to know whether this is supported or not.

CONTRIBUTING

To contribute back to this project, log in to your GitHub account and visit http://github.com/shutterstock/perl-db-transaction, then fork the repository.

Create a feature branch, make your changes, push them back to your fork, and submit a pull request via GitHub.

# fork the project in github

git clone git://github.com/<your-name>/perl-db-transaction.git
git checkout -b feature-add-spiffy-functionality

emacs -nw t/spiffy-functionality.t   # hack hack hack
emacs -nw lib/DB/Transaction.pm      # hack hack hack

git push feature-add-spiffy-functionality origin

# submit pull request via github

AUTHORS

Written by Aaron Cohen <[email protected]> and Belden Lyman <[email protected]> at Shutterstock, Inc. Released to CPAN by Shutterstock, Inc.

If you like the idea of working at a company that supports open-source development, why not checkout our jobs page and drop us a line?

COPYRIGHT AND LICENSE

(c) 2013 Shutterstock, Inc. All rights reserved.

This library is free software: you may redistribute it and/or modify it under the same terms as Perl itself; either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

db-transaction's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.