dbix :: oo :: tree.DBIX :: OO :: TREE´Â "Áßø µÈ ¼¼Æ®"¸ðµ¨À» »ç¿ëÇÏ¿© °èÃþ Àû µ¥ÀÌÅ͸¦ Á¶ÀÛÇÏ´Â PERL ¸ðµâÀÔ´Ï´Ù. | |
Áö±Ý ´Ù¿î·Îµå |
dbix :: oo :: tree. ¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- Perl Artistic License
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Mihai Bazon
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~mishoo/DBIx-OO-v0.0.4/lib/DBIx/OO.pm
dbix :: oo :: tree. ű×
dbix :: oo :: tree. ¼³¸í
DBIX :: OO :: TREE´Â "Áßø µÈ ¼¼Æ®"¸ðµ¨À» »ç¿ëÇÏ¿© °èÃþ Àû µ¥ÀÌÅ͸¦ Á¶ÀÛÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. DBIX :: OO :: TREE´Â "Áßø µÈ ¼¼Æ®"¸ðµ¨À» »ç¿ëÇÏ¿© °èÃþ Àû µ¥ÀÌÅ͸¦ Á¶ÀÛÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Å×À̺í Ä«Å×°í¸® (ID Á¤¼ö ºÎÈ£¾ø´Â Auto_Increment ±âº» Å°, Label VARCHAR (255), -ÀÌ ¿Àº DBIX¿¡ ÀÇÇØ ÇÊ¿äÇÕ´Ï´Ù. : oo :: tree parent integer ºÎÈ£¾ø´Â, lft Á¤¼ö in null, rgt Á¤¼ö in null, mvg tinyint default 0, index (lft), À妽º (RGT), À妽º (MVG), À妽º (»óÀ§); * * * ÆÐÅ°Áö Ä«Å×°í¸®; ±âº» 'dbix :: oo'¸¦ »ç¿ëÇϽʽÿÀ. dbix :: oo :: tree; __package __-> Å×À̺í ( 'Ä«Å×°í¸®'); __package __-> ¿ (p => , e => ); # LFT, RGT, MVG ¶Ç´Â ºÎ¸ð¸¦ ¼±¾ð ÇÒ ÇÊ¿ä°¡ ¾ø½À´Ï´Ù. ¿ì¸®´Â À¯¿ë ÇÒ ¼öµµ Àֱ⠶§¹®¿¡ ºÎ¸ð¸¦ ¼±¾ðÇÏÁö¸¸ # dbix :: oo : Æ®¸®´Â ³·Àº ¼öÁØÀÇ SQL¿¡¼ ÀÛµ¿ÇÏÁö ¾ÊÀ¸¹Ç·Î DBIX :: OO °´Ã¼ ¿¡ÀÌ Çʵ尡 ÀÖÀ½ÀÌ ¾Æ´Õ´Ï´Ù. # ¾Æ·¡ ÄÚµå´Â ³» $ Electronics = Ä«Å×°í¸® -> TREE_APPEND ({label => Electronics '})¿¡ Á¦½ÃµÈ ±¸Á¶¸¦ »ý¼ºÇÕ´Ï´Ù. ³» $ TVS = $ Electronics-> tree_append ({label => ÅÚ·¹ºñÀü '}); ³» $ tube = $ TVS-> tree_append ({label => 'tube'}); MY $ PLASMA = $ TVS-> TREE_APPEND ({label => 'plasma'}); MY $ LCD = $ plasma-> tree_insert_before ({label => 'lcd'}); MY $ PRITABLE = $ TVS-> TREE_INSERT_AFTER ({label => 'ÈÞ´ë¿ë ÀüÀÚ ÀåÄ¡'}); MY $ MP3 = $ PORTABLE-> TREE_APPEND ({label => 'mp3 Ç÷¹À̾î'}); MY $ Flash = $ MP3-> TREE_APPEND ({label => flash '}); MY $ CDS = $ PORTABLE-> TREE_APPEND ({label => 'CD Ç÷¹À̾î'}); MY $ RADIOS = Ä«Å×°í¸® -> TREE_APPEND ($ PRITABLE-> ID, {label => '2 way radios'}); # Subtree ³» $ data = $ Electronics-> tree_get_subtree ({fields => }); ³» $ ·¹º§ = ¹üÁÖ -> tree_compute_levels ($ µ¥ÀÌÅÍ); Foreach My $ i (@ $ data) {print 'x $ levels -> {$ i -> {id}}, $ i -> {label}, "n"; } ## ¶Ç´Â ¹Ýȯ µÈ µ¥ÀÌÅÍ¿¡¼ DBIX :: OO ¿ÀºêÁ§Æ®¸¦ ÀÛ¼ºÇϽʽÿÀ. MY $ ARRAY = ¹üÁÖ -> init_from_data ($ µ¥ÀÌÅÍ); Àμâ Á¶ÀÎ ( "n", ({x $ ·¹º§ -> {$ _-> id}. $ _-> label} @ $ ¹è¿)); # µð½ºÇ÷¹ÀÌ °æ·Î Á¤º¸ MY $ DATA = $ Flash-> TREE_GET_PATH; Àμâ Á¶ÀÎ ( "n", ({$ _-> {label}} @ $ data); # $ MP3-> TREEPARENT ($ LCD-> ID) ÁÖÀ§·Î # ³ëµå À̵¿; $ TVS-> TREE_REPERENT ($ ÈÞ´ë¿ë -> ID); $ CDS-> TREE_REPERENT (Undef); $ plasma-> tree_move_before ($ tube-> id); $ Portable-> Tree_Move_before ($ Electronics-> ID); # »èÁ¦ ³ëµå $ LCD-> TREE_DELETE;ÀÌ ¸ðµâÀº DBIX :: OO¸¦ »ç¿ëÇÏ¿© ¿¡ Á¦½ÃµÈ "Áßø µÈ ¼¼Æ® ¸ðµ¨"À» »ç¿ëÇÏ¿© µ¥ÀÌÅͺ£À̽º¿¡ Æ®¸®¸¦ ÀúÀåÇÒ ¼ö ÀÖµµ·Ï º¸¿ÏÇÕ´Ï´Ù. ÁÖ¿ä ¾ß¸ÁÀº µ¥ÀÌÅ͸¦ °Ë»ö ÇÒ ¶§ ¸Å¿ì ºü¸£°ÔµÇ±â À§Çؼ´ÂÀÌ (¾÷µ¥ÀÌÆ® -S, »ðÀÔ ¶Ç´Â DELETE-SÀÇ ¼º´É¿¡ ´ëÇÑ Èñ»ý)ÀÔ´Ï´Ù. ÇöÀçÀÌ ¸ðµâÀº ´ÙÀ½ ¿À» Å×ÀÌºí¿¡ °¡Á®¾ßÇÕ´Ï´Ù. - ID : ±âº» Å° (Á¤¼ö) - »óÀ§ ³ëµå (·çÆ® ³ëµåÀÇ null¿¡ ´ëÇÑ null) - lft, rgt : ³ëµå À§Ä¡ ÀúÀå - mvg : »ç¿ëµÊ ³ëµå¸¦ À̵¿ÇÒ ¶§ "ºÎ¸ð"¿Í "MVG"°¡ ¿¡ Á¦½ÃµÈ °Íó·³ Áßø ¼¼Æ® ¸ðµ¨¿¡ ÀÇÇØ eSentially ÇÊ¿äÇÏÁö ¾ÊÁö¸¸ÀÌ ¸ðµâÀÌ ÀÛµ¿ÇÏ´Â µ¥ ÇÊ¿äÇÕ´Ï´Ù. ƯÈ÷ "MVG"´Â TREE_REPERENT ()¿Í °°Àº ³ëµå¸¦ À̵¿ÇÏ´Â ±â´É¿¡ ÀÇÇؼ¸¸ ÇÊ¿äÇÕ´Ï´Ù. ÁÖº¯ÀÇ ³ëµå¸¦ À̵¿ÇÏÁö ¾ÊÀ¸·Á¸é "mvg"À» »ý·« ÇÒ ¼ö ÀÖ½À´Ï´Ù .retrieval ÇÔ¼ö´Â ¸Å¿ì ºü¸£°ÔµË´Ï´Ù (ÇϳªÀÇ SQL ½ÇÇà). ¼Óµµ¸¦ ³ôÀÌ·Á¸é DBIX :: oo Ãູ¹ÞÀº ¹°Ã¼°¡ ¾Æ´Ï¶ó Çؽà ¹è¿À» ¹ÝȯÇÏÁö ¾Ê½À´Ï´Ù. DBIX :: oo-> init_from_data ()¸¦ È£ÃâÇÏ¿© dbix :: oo °³Ã¼¸¦ ¸¸µé ½±½À´Ï´Ù. (´õ ÀÚ¼¼ÇÑ Á¤º¸´Â dbix :: oo ÂüÁ¶). ±×·¯³ª ÇÔ¼ö¸¦ »èÁ¦Çϰųª »èÁ¦ / À̵¿ÇÔÀ¸·Î½á ³ª¹« ¹«°á¼º. ÇöÀç ÀϾ´Â ÀÏÀº ´ÙÀ½°ú °°½À´Ï´Ù. - Tree_Append, Tree_Insert_before, Tree_Insert_after -ÀÌ ½ÇÇà ÇϳªÀÇ ¼±Åðú µÎ °³ÀÇ update-s (ÀáÀçÀûÀ¸·Î ¸¹Àº Çà¿¡ ¿µÇâÀ» ¹ÌÄ¥ ¼ö ÀÖÀ½). - TREE_DELETE : ÇϳªÀÇ ¼±ÅÃ, ÇϳªÀÇ »èÁ¦ ¹× µÎ °³ÀÇ update-sÀ» ½ÇÇàÇÕ´Ï´Ù. - Tree_Reparent - 2 Select-S ¹× 7 update-s¸¦ ½ÇÇàÇÕ´Ï´Ù. ³ª´Â ÀÌ°ÍÀÌ ²ûÂïÇÑ ¼Ò¸®°¡ µé¸°´Ù - ´ç½ÅÀÌ ´õ ³ªÀº ¾ÆÀ̵ð¾î°¡ ÀÖ´Ù¸é ³ª´Â ±×µéÀ» µè°í ½Í½À´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ Perl.
dbix :: oo :: tree. °ü·Ã ¼ÒÇÁÆ®¿þ¾î
Perl :: Metric :: Basic.
Perl :: Metric :: BasicÀº ±âº» ¼ÒÇÁÆ®¿þ¾î ¸ÞÆ®¸¯À» Á¦°ø ÇÒ ¼öÀÖ´Â Perl ¸ðµâÀÔ´Ï´Ù. ...
331