NAME

Egg::Plugin::DBIC::Transaction - The method related to the transaction etc. of DBIC for Egg is offered.

SYNOPSIS

my $dbh= $e->myapp_dbh;                    # <= $e->model('myApp')->storage->txn_dbh;

my $schema= $e->myapp_schema;              # <= $e->model('myApp');

my $table = $e->myapp_table('myMoniker');  # <= $e->model('myApp:myMoniker');

$e->myapp_commit;                          # <= $e->model('myApp')->storage->txn_commit;

# Two or more Schema is settled and commit is done.
$e->commit(qw/ myApp remoteApp /);

# When the processing of Egg ends, commit is done.
$e->myapp_commit_ok(1);

# Commit_ok of two or more Schema is settled and set.
$e->commit_ok(qw/ myApp remoteApp /);

$e->myapp_rollback;                        # <= $e->model('myApp')->storage->txn_rollback;

# Two or more Schema is settled and rollback is done.
$e->rollback(qw/ myApp remoteApp /);

# When the processing of Egg ends, rollback is done.
$e->myapp_rollback_ok(1);

# Rollback_ok of two or more Schema is settled and set.
$e->rollback_ok(qw/ myApp remoteApp /);

DESCRIPTION

This plug-in offers a convenient accessor to treat DBIC, and semi-automates the processing of the transaction.

BEGIN is always done at the start of processing of Egg and the transaction is begun. And, when processing is ended, COMMIT is done and the transaction is ended if ROLLBACK or commit_ok is effective.

As a result, it comes do not to have to consider BEGIN and ROLLBACK, etc. on the application side.

* Please make commit_ok effective in the application when you do COMMIT.

DBIx::Class : http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/DocMap.pod.

METHODS

* The error doesn't occur even when AutoCommit is invalidly used. Moreover, the method doesn't do anything even if called. However, the method for the data base handler and the model acquisition functions.

[schema_name]_begin.

The transaction of Schema is begun.

Because this is called by the automatic operation when processing begins, it is not necessary to call from the application.

[schema_name]_dbh

The data base handler of Schema is returned.

* It is the same as $e->model([schema_name])->storage->txn_dbh.

[schema_name]_schema

The object of Schema is returned.

* It is the same as $e->model([schema_name]).

[schema_name]_table ([source_name])

The table object in Schema is returned.

* It is the same as $e->model([schema_name])->resultset([source_name]) and $e->model([schema_name]:[source_name]).

[schema_name]_commit

COMMIT of Schema is issued.

* It is the same as $e->model([schema_name])->storage->txn_commit.

[schema_name]_rollback

ROLLBACK of Schema is issued.

* It is the same as $e->model([schema_name])->storage->txn_rollback.

[schema_name]_commit_ok([Boolean]);

It is reserved to do COMMIT when the transaction is ended.

* 0 If is passed, it becomes a cancellation.

[schema_name]_rollback_ok([Boolean]);

Because it tries to issue ROLLBACK whenever the transaction is ended, this method need not usually be called. * To make the syntax comprehensible.

commit ([schema_list])

COMMIT does all passed Schema.

commit_ok ([schema_list])

COMMIT of all passed Schema is reserved.

rollback ([schema_list])

ROLLBACK does all passed Schema.

rollback_ok ([schema_list])

ROLLBACK of all passed Schema is reserved.

...others.

Do not call these methods from the code.

setup

Prior because of the start is prepared.

prepare

Prior because of the project object generation is prepared.

output_content

When this method call is called from Engine, it commits it.

error_finalize

It is a handler to do the rollback when the error occurred.

SEE ALSO

Egg::Model::DBIC, Egg::Release,

AUTHOR

Masatoshi Mizuno, <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.

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