DBIX :: OO.

DBIX :: OO´Â Perl °´Ã¼ Ãß»óÈ­ÀÇ µ¥ÀÌÅͺ£À̽ºÀÔ´Ï´Ù.
Áö±Ý ´Ù¿î·Îµå

DBIX :: OO. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • Perl Artistic License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Mihai Bazon
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~mishoo/DBIx-OO-v0.0.4/lib/DBIx/OO.pm

DBIX :: OO. ű×


DBIX :: OO. ¼³¸í

DBIX :: OO´Â Perl °´Ã¼ Ãß»óÈ­ÀÇ µ¥ÀÌÅͺ£À̽ºÀÔ´Ï´Ù. DBIX :: OO´Â Perl Objects Abstraction.Snopsis Package MyDBÀÇ µ¥ÀÌÅͺ£À̽ºÀÔ´Ï´Ù. ±âº» 'dbix :: oo'¸¦ »ç¿ëÇϽʽÿÀ. # Ãß»óÀû ÀÎ ÇÔ¼öÀ̹ǷΠGet_DBH¸¦ µ¤¾î ¾µ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù. # DB¿¡ ¿¬°áÇÏ´Â ¹æ½ÄÀº Á¤¸»·Î ´ç½ÅÀÇ Á÷¾÷ÀÔ´Ï´Ù. ÀÌ ±â´ÉÀº µ¥ÀÌÅͺ£À̽º ÇÚµéÀ» ¹ÝȯÇؾßÇÕ´Ï´Ù. ±âº» get_dbh () croaks. ³» $ dbh; sub get_dbh {$ dbh = dbi-> connect_cached ( 'dbi : mysql : test', '»ç¿ëÀÚ', 'passwd')! Á¤ÀÇ µÈ $ dbh; ¹Ýȯ $ dbh; } ÆÐÅ°Áö mydb :: »ç¿ëÀÚ; ±âº» 'mydb'¸¦ »ç¿ëÇϽʽÿÀ. __package __-> Å×À̺í ( '»ç¿ëÀÚ'); __package __-> ¿­ (p => , e => ); __package __-> has_many (pages => 'mydb :: pages', '»ç¿ëÀÚ'); ÆÐÅ°Áö mydb :: ÆäÀÌÁö; ±âº» 'mydb'¸¦ »ç¿ëÇϽʽÿÀ. __package __-> Å×À̺í ( 'ÆäÀÌÁö'); __package __-> ¿­ (p => , e => ); __package __-> has_a (user => 'mydb :: users); ÆÐÅ°Áö ¸ÞÀÎ; MY $ u = mydb :: reserment-> create ({id => userid ', first_name =>'q ', last_name =>'w '}); MY $ foo = mydb :: recessage-> °Ë»ö ( 'userid'); @p = @ {$ foo-> fk_pages}; "»ç¿ëÀÚ :", $ foo-> first_name, "", $ foo-> last_name, "ÆäÀÌÁö : n"À» ÀμâÇϽʽÿÀ. foreach (@p) {$ _-> Á¦¸ñ "n"; } $ foo-> first_name ( 'John'); $ foo-> last_name ( 'doe'); # ¶Ç´Â $ foo-> set (first_name => 'john', last_name => doe '); $ foo-> ¾÷µ¥ÀÌÆ®; ¿ä±¸ »çÇ× : ¡¤ Perl.


DBIX :: OO. °ü·Ã ¼ÒÇÁÆ®¿þ¾î