際際滷
Submit Search
Catalyst and Rose::DB
Download as PPT, PDF
0 likes
509 views
于舒仆 mrRico
Follow
弌仂亰亟舒仄 亟仍 Catalyst 仄仂亟亠仍 仆舒 orm Rose::DB
Read less
Read more
1 of 14
Download now
More Related Content
Catalyst and Rose::DB
1.
Catalyst and Rose::DB
弍仂从舒
2.
Rose::DB 仗亳舒仆亳亠 舒弍仂
ORM 仄仂亳 亰亟亠
3.
Rose::DB (+)
仆舒亳亠仍仆仂 弍亠亠, 亠仄 DBIx::Class 仂亠 于 仂仄亳仂于舒仆亳亳 亰舒仗仂仂于 亠 舒从 束舒亠仆損, 从舒从 DBIx::Class , 亟仍 仗亠亠仂亟亳 DBI 仗仂亢舒仍亶 于.
4.
Rose::DB (-)
亠亠仂亰亟舒仆亳亠 从仍舒仂于 舒弍仍亳 亰舒 于亠 亟仂弍舒于仍亠仆仆亠 仗仂亞舒仄仄亳仂仄 仄亠仂亟 (于 仂仍亳亳亠 仂 DBIx::Class ). 丼仂 舒从舒仍仆仂 仗亳 亳亰仄亠仆亠仆亳亳 从 弍舒亰. get_ 亳仄碽舒弍仍亳 _iterator 仄仂亢亠 仗舒 仗仂 Out of memory, 亠仍亳 于仂亰于舒舒亠 亟亠亶于亳亠仍仆仂 仄仆仂亞仂 仂从. 亳 仗亠亠仂亟亠 仗仂 仂仆仂亠仆亳 仄亠亢亟 舒弍仍亳舒仄亳 (仆舒仗亳仄亠 仂亟亳仆-从仂-仄仆仂亞亳仄), 于 仆亠 仄仂亢亠亠 从仂仆从亠亳亰亳仂于舒 亰舒仗仂. 舒仄 于亠仆 于亠 仂从亳. 仄仂, DBIx::Class 于 仂仄 仄仍亠 仄亠仆亠亠 亳亰弍仂亠仆.
5.
亳从亳于舒亠仄 从
Catalyst 仂仗亳仄, 于 仗舒于亳仍仆仂 舒从亳仍亳 仄舒仆舒仍 仗仂 Rose::DB , 亳 于 亠 仂亳亠 仗亳从亳 亳仄亠仆仆仂 仂 ORM 从 于舒亠仄 仗亳仍仂亢亠仆亳. 仂 亢 仂亞亟舒 仄 亳亟仄 从 舒仄. 亟亠仄 亳舒, 仂 舒 亢亠 舒亰于仆仂 cat- 仗亳仍仂亢亠仆亳亠 亳 仂仆仂 仆舒亰于舒亠 MList .
6.
亳从亳于舒亠仄 从
Catalyst 亳弍仍亳亰亳亠仍仆舒 从舒 仗舒仗仂从 舒亠亞仂 仗仂亠从舒: View/ Model/ Controller/ MList/ lib/ MList/ any_path/ /
7.
亳从亳于舒亠仄 从
Catalyst 舒仄 仗仂亠弍ム 2 仄仂亟仍. 仂亟仆仂仄 亳亰 仆亳 ( RDB.pm ) 弍亟亠 仂仗亳舒仆 从仂仆仆亠从, 于仂 于仂仂仄 ( RDBBase .pm) 仗仂亟从仍ム亠仆亳亠. 舒从, 仂亰亟舒仄 RDB.pm 仗仂 仗亳 /any_path/MList/lib/MList/Model : package MList::Model::RDB; use warnings; use strict; use base qw(Rose::DB); __PACKAGE__->use_private_registry; __PACKAGE__->register_db( driver => 'mysql', type => 'main', database => basename', host => db_host', username => user', password => password', connect_options => { AutoCommit => 1, RaiseError => 1, } ); 1;
8.
亳从亳于舒亠仄 从
Catalyst 弌仂亰亟舒仄 仄仂亟亠仍 RDBBase $ cd /any_path/MList $ script/mlist_create.pl model RDBBase *仂亰亟舒仆亳亠 仄仂亟仍 亠亠亰 script/mlist_create.pl 仆亢仆仂, 仂弍 于舒 舒于仂仄舒亳亠从亳 仂亰亟舒仍亳 亠 亟仍 仂亟亠仍亳 于 仗舒仗从亠 t/ . 仂亠亟舒从亳亠仄 仗仂仍亠仆仆 仄仂亟亠仍 亟仂 于亳亟舒: package MList::Model::RDBBase; use strict; use MList::Model::RDB; use Rose::DB::Object; our @ISA = qw(Rose::DB::Object); use parent 'Catalyst::Model'; # 于仂 舒从 从仂亠从仆仂 仗仂亟从仍ム舒亠 helper 于 于舒亠仄 cat- 仗亳仍仂亢亠仆亳亳 亟仍 Rose::DB use Rose::DB::Object::Helpers qw(load_or_insert load_speculative); sub init_db {MList::Model::RDB->new(type => 'main')} # 仄亠仂亟 亟仍 亟仂仗舒 从 从仍舒 Manager 于舒亠亶 舒弍仍亳 sub custom_rdb_manager {$_[0].'::Manager'} 1;
9.
亳从亳于舒亠仄 从
Catalyst 仂亞仂 于舒 仗仂仍亳仍仂 仍亠亟ム亠亠: RDB.pm RDBBase.pm View/ Model/ Controller/ MList/ lib/ MList/ any_path/ /
10.
亳从亳于舒亠仄 从
Catalyst 丐亠仗亠 仂亰亟舒仄 从亳仗, 从仂仂亶 于仍亠 仆舒仄 从 弍舒亰 于 从仍舒 Rose::DB::Object , 亳仗仂仍亰 仂亰亟舒仆仆亠 RDB.pm 亳 RDBBase.pm . #!/usr/bin/perl use warnings; use strict; use Rose::DB::Object::Loader; use lib ' /any_path/MList/lib '; use MList::Model::RDB; use MList::Model::RDBBase; my $loader = Rose::DB::Object::Loader->new( db => MList::Model::RDB->new(type => 'main'), class_prefix => 'MList::Model::RDB', base_classes => 'MList::Model::RDBBase', with_foreign_keys => 1, with_relationships => 1 ); $loader->make_modules( module_dir=>' /any_path/MList/lib ', exclude_tables=>'Tmp' ); exit;
11.
亳从亳于舒亠仄 从
Catalyst use lib 仗仂亰于仂仍磳 仗仂亟亞亰亳 仂亰亟舒仆仆亠 仄仂亟仍亳. make_modules 仂 仄亠仂亟 于仍亠 从 舒弍仍亳, 仗亳 仂仄, 仗舒舒仄亠 exclude_tables => Tmp 亳从仍ム亳 亳亰 仂弍舒弍仂从亳 舒弍仍亳. 弌仂仂于亠于ム亳亠 regexp /^Tmp/ 仍 仂亰仆舒从仂仄仍亠仆亳 亟亞亳仄亳 仗舒舒仄亠舒仄亳. 仄仂亢亠亠 仂亰仆舒从仂仄亳 Rose::DB::Object::Loader . 舒从, 仗仂仍亠 亰舒仗从舒 从亳仗舒, 仗仂 仗亳 /any_path/MList/lib/MList/Model/RDB 于 仄仂亢亠亠 于亳亟亠 于亠 仂亰亟舒仆仆亠 从仍舒. 亠亞亟舒 仗仂仄仆亳亠, 仂 仂 仆亠 DBIx::Class , 亳 亠仍亳 于舒 亢亠 弍仍亳 仂亰亟舒仆亠 仗仂 仂仄 仗亳 从仍舒 舒弍仍亳, 仂 Rose::DB::Object::Loader 仗仂仂 仗亠亠亰舒仗亳亠 亳 .
12.
仗仂仍亰仂于舒仆亳亠 仂仗亳仄
于舒 于 弍舒亰亠 弍仍舒 舒弍仍亳舒 ml_persons . 丐仂亞亟舒 亟仍 仆亠 弍亟 仂亰亟舒仆 2 仄仂亟仍: /any_path/MList/lib/MList/Model/RDB/MlPerson . pm 亅仂 仄仂亟仍 仂于亠舒亠 亰舒 于弍仂从 仂从 亳亰 舒弍仍亳. 弍舒亠仆亳亠 从 仆亠仄: $c->model(RDB::MlPerson) - >any_method( ) , 亞亟亠 any_method 仂 仄亠仂亟 Rose::DB::Object /any_path/MList/lib/MList/Model/RDB/MlPerson/Manager . pm 亅仂 仄仂亟仍 仂于亠舒亠 亰舒 仂弍舒弍仂从 仆舒弍仂舒 仂从 亳亰 舒弍仍亳. 弍舒亠仆亳亠 从 仆亠仄: $c->model(RDB::MlPerson::Manager) - >any_method( ) , 亞亟亠 any_method 仂 仄亠仂亟 Rose::DB::Object ::Manager
13.
仗仂仍亰仂于舒仆亳亠 仂亞仂
于舒 仗仂仍亳仍仂 仍亠亟ム亠亠: Manager.pm MlPerson.pm MlPerson/ RDB.pm RDBBase.pm RDB/ View/ Model/ Controller/ MList/ lib/ MList/ any_path/ /
14.
仗仂仍亰仂于舒仆亳亠 , 仆舒仗仂仍亠亟仂从,
于仗仂仄仆亳仄 仗仂 仆亠仂弍磶舒亠仍仆亶 仄亠仂亟: sub custom_rdb_manager {$_[0].'::Manager'} 亳亰 仄仂亟仍 RDBBase .pm . 仆 仗仂亰于仂仍磳 于舒仄 亟亠仍舒 于仂 舒从亳亠 仂弍舒亠仆亳: $c->model(RDB::MlPerson) - > custom_rdb_manager- >any_method( ) , 亞亟亠 any_method 仂 仄亠仂亟 Rose::DB::Object ::Manager 亟亠 于舒亢仆仂, 仂弍 仆舒亰于舒仆亳亠 仄亠仂亟舒 (从仂仂仂亠 于 亟舒亟亳亠) 仗仂仂 仆亠 仂于仗舒亟舒仍仂 仆舒亰于舒仆亳亠仄 仆亳 仂亟仆仂亞仂 仗仂仍 于 弍舒亰亠. 仂, 亟舒仆仆亶 仄亠仂亟 仂仗亳仂仆舒仍亠仆 亳, 于 于亠亞亟舒 仄仂亢亠亠 仂弍舒舒 从 从仍舒舒仄 ::Manager 舒从, 从舒从 弍仍仂 仗仂从舒亰舒仆仂 仆舒 仗亠亟亟亠仄 仍舒亶亟亠.
Download