2009å¹´06æ17æ¥00:13 Perl DBICã®ãªã¬ã¼ã·ã§ã³ãè¦æã§ä½¿ããã³ã«èª¿ã¹ãªããã®ãé¢åãªã®ã§ã¾ã¨ãã¦ã¿ã ãDBICã®ãªã¬ã¼ã·ã§ã³ã¨ããæ¯å使ããã³ã«èª¿ã¹ã¦ã¦æéãå¿ä½ç¡ããã¨æã£ã¦ã¾ã¨ãã¦ã¿ã¾ãããç°¡åãªä¾ã¨ãã¦ãentryãã¼ãã«ã¨commentãã¼ãã«ãèãã¦ã¿ã¾ãããã mysql> desc entry; +---------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment |
ä»æ¥ãCatalyst & DBIC ã®ã話ããã¼ãã«ã«ãã¼ã¿ãINSERTããã¨ãã«ããã®ã¬ã³ã¼ãã®ä½ææ¥ã¨ãã¦create_date ã¿ãããªã«ã©ã ãç¨æããäºã¯å¤ãããï¼ã§ãã ããããã®ã«ã©ã ã«ã¯default ã«now()ã¨ãsysdate() ãè¨å®ããäºãå¤ããã ã§ããç¡ç²¾ãã¦default ãã»ããããªãäºã沢山ããããããã®å ´åã«ã¯INSERTæãã¤ã¾ãDBICã§ã¯create æã«now() ãçªã£è¾¼ã¿ãããªããã§ãããããæå¤ã¨ç°¡åã«ã¯ãããªãã DBICã§æ¬å½ã«å°ã£ãã SCALAR REFERNCE ã使ãã£ã¤ããã¨ã§ãã¹ã«ã©ã¼ãªãã¡ã¬ã³ã¹ã§è§£æ±ºãã¾ããã ãããªæã my $map = $c->model( 'DBIC::TranMatchmake' )->create({ user_id => $c->session->{user_id}, user_name
ååã®ééããä¿®æ£ãã¾ããã ä»åã¯Catalystã§DBICã使ãéãsearchã§joinãå®ç¾ããæ¹æ³ã説æãã¾ãã ä¾ã¢ããªã±ã¼ã·ã§ã³åã¯MyAppã ã¦ã¼ã¶ã¼æ å ±ãæ ¼ç´ãã¦ããUser ã¨ãããã¼ãã«ããããããã«ã¯é½éåºçãã³ã¼ãã§æ ¼ç´ããã¦ããã é½éåºçã¯Pref ã¨ããã¼ãã«ã«ã³ã¼ã(pref_id)ã¨é½éåºçå(pref_name)ã1対1ã§å¯¾å¿ãã¦ããã ã¾ããmodel ã¯ä¸è¨ã®ãã«ãã¼ã¹ã¯ãªããã§æ©æ¢°çã«ä½ã£ã¦ãã¾ãã ã...?script/myapp_create.pl model DBIC DBIC DBI:mysql:mydb user passããï¼Catalyst::Model::DBICï¼ã¯ãã¾ãæ¨å¥¨ããã¦ããªãããã§ãã®ã§ãCatalyst::Model::DBIC::Schema ã使ãããã«ãã¾ããããscript/myapp_create.p
åå¶ DBIx::Class::Manual::Cookbook - ã¬ã·ããããã ã¬ã·ã¶ æ¤ç´¢Â¶ ãã¼ã¸å¦çãããçµæã»ã㶠When you expect a large number of results, you can ask DBIx::Class for a paged resultset, which will fetch only a small number of records at a time: çµæã»ãããè¨å¤§ã«ãªããããªãããã¼ã¸å¦çãããçµæãDBIx::Classã§åå¾ã§ãã¾ãã ä¸åã«ãå°ãã®ã¬ã³ã¼ãããã¨ã£ã¦ãã¾ãã: my $rs = $schema->resultset('Artist')->search( undef, { page => 1, # page to return (defaults to 1) rows => 10, #
Data::Page::Navigationãªãªã¼ã¹ãã¾ãã CPANã®indexerã復活ãããããªã®ã§ååä¸ã«ã¢ããããData::Page::Navigationãã§ã¦ããããã«ãªãã¾ããã é¢é£ã¨ã³ããªã¼ 1st Data::Pageã¨ãã¼ã¸ããã²ã¼ã·ã§ã³ 2nd Data::Page::Navigationãããæãã®ãã¼ã¸ããã²ã¼ã·ã§ã³ 使ãæ¹ã¯ã use Data::Page::Navigation; ã¨useããã ãã§ãã ãã¨ã¯æ®éã« my $pager = Data::Page->new(100,10,2); ã¨Data::Pageã®ãªãã¸ã§ã¯ããçæãã¾ããããã¨ã表示ãããã¼ã¸çªå·ã®ãªã¹ããã¤ããpages_in_navigationã¡ã½ããã使ããããã«ãªã£ã¦ã¾ãã my @list = $pager->pages_in_navigation(); Catalys
2009å¹´05æ16æ¥13:45 Perl Catalystã®Chainedã¢ã¯ã·ã§ã³ã使ãããªãããã®3ã¤ã®ã«ã¼ã« åã¯æè¿ãChainedã¢ã¯ã·ã§ã³ãè¯ã使ã£ã¦ãã¾ããã ã£ã¦ã¨ã£ã¦ã便å©ãªãã§ãï¼ï¼ ç¹ã« http://localhost:3000/hoge/*/*/edit ã¿ãããªè¤éãªURLã«å¯¾ããã¢ã¯ã·ã§ã³ãä½ãããã¨ããªã©ã大活èºã§ãï¼æè¿ã§ã¯autoã¨ãbeginãChainedã§ä»£ç¨ããããã«ããã(*´Ðï½*) ãµã³ãã«ã¯ãããªæãã sub mysetup : Chained('/') PathPart('') CaptureArgs(2) { my ($self, $c, @arg) = @_; $c->log->debug("in mysetup"); $c->log->debug( $arg[0] ); $c->log->debug( $arg[1] ); }
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}