Egg::Model::DBIC - Model for DBIx::Class.
my $schema= $e->model('dbic::myschema'); # If the transaction is effective. $schema->storage->txn_begin; my $table= $schema->resultset('hoge_master'); Or my $table= $e->model('dbic::myschema::hoge_master'); $table->search( ... ); # And. $schema->storage->txn_rollback; Or $schema->storage->txn_commit;
It is MODEL to use DBIx::Class.
A series of Schema module is generated by using the helper for use.
% cd /path/to/MyApp/bin % ./myapp_helper.pl M::DBIC [SCHEMA_NAME] -d dbi:SQLite:dbname=dbfile -u user -p passwd
The name that can be used as Perl module name in the part of SCHEMA_NAME is passed.
The option to continue is not indispensable.
Details are Egg::Helper::Model::DBIC. Please drink and refer to the document.
And, 'DBIC' is added to the MODEL setting of the project.
% vi /path/to/MyApp/lib/MyApp/config.pm .......... ... MODEL => ['DBIC'],
Using this model by this becomes possible.
When the object of Schema is acquired from the application, as follows is done.
my $schema= $e->model('dbic::schema_name');
The object to which DBIx::Class::Schema is succeeded to by this can be received.
And, the object of the table does as follows.
my $table = $e->model('dbic::schema_name::table_name'); # If you have already acquired the Schema object. my $table = $schema->resultset('table_name');
The object to which DBIx::Class::ResultSet is succeeded to by this can be received.
Masatoshi Mizuno, <firstname.lastname@example.org>
Copyright (C) 2008 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.