Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Egg::Model::DBIC
DBIx::Class for Egg Model.

Egg::Model::DBIC - DBIx::Class for Egg Model.


NAME

Egg::Model::DBIC - DBIx::Class for Egg Model.


SYNOPSIS


  __PACKAGE__->egg_startup(

    ...

    .....

  

    MODEL=> [

      [ DBIC => { schema_names => [qw/ MySchema /] } } ],

     ],

  

    );

  # The object of MyApp::Model::DBIC::MySchema is acquired.

  my $model= $e->model('MySchema');

  

  # If the transaction is effective.

  $model->storage->txn_begin;

  

  # The object of MyApp::Model::DBIC::MySchema::Moniker is acquired.

  my $db = $model->resultset('Moniker');

     or

  my $db = $e->model('myscema:moniker');

  

  $db->search( ... );

  

  $model->storage->txn_commit;

    or

  $model->storage->txn_rollback;


DESCRIPTION

It is MODEL to use DBIx::Class.

Appropriate Schema is generated by using the helper for use.


  % perl myapp_helper.pl Model:DBIC MySchema -d dbi:Pg:dbname=dbname -u user -p passwd

/path/to/MyApp/lib/MyApp/Model/DBIC/MySchema is generated with this.

* Please refer to the document of Egg::Helper::Model::DBIC for details for helper's use.

And, the setting of following MODEL is added.


  MODEL => [ [ DBIC => {} ] ],

All modules under the control of/path/to/MyApp/lib/MyApp are read by this as Schema. * Specification becomes empty HASH.

If the module such as Schema for the test that doesn't want to be read exists together, the name of Schema is specified.


  MODEL=> [

    [ DBIC => { schema_names => [qw/ MySchema /] } ],

   ],

Schema can be acquired for the small letter specification.


  my $schema = $e->model('myschema');

When the source is acquired, it specifies it by the small letter without fail.


  my $source = $e->mode('myschema:source');

When the object is acquired, it only has to operate it the DBIx::Class manpage originally.

Please refer to the document of the DBIx::Class manpage for details.


CREATE SCHEMA SOURCE

Please note the following respect when you make the Schema file by oneself.

  • The Schema module succeeds to Egg::Model::DBIC::Schema.
  • a necessary method for Schema to operate on Egg such as 'config' is added.
    
      package MyApp::MySchema;
    
      use strict;
    
      use warnings;
    
      ## use base 'DBIx::Class::Schema';
    
      
    
      use base qw/Egg::Model::DBIC::Schema/;
    
      
    
      __PACKAGE__->config(
    
        dsn      => 'dbi:Pg:dbname=mydata',
    
        user     => 'user',
    
        password => 'passwd',
    
        );
    
      
    
      ...
    
      .....


SEE ALSO

the DBIx::Class manpage, the DBIx::Class::Schema manpage, the Egg::Model::DBIC::Schema manpage, the Egg::Model::DBIC::Moniker manpage, the Egg::Helper::Model::DBIC manpage, the Egg::Release manpage,


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.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy