°ü°è :: °¡Á·

°ü°è :: Æйи®´Â DBI / DBD :: MySQL °ü°è Äõ¸® ¿£Áø ¸ðµâÀÔ´Ï´Ù.
Áö±Ý ´Ù¿î·Îµå

°ü°è :: °¡Á· ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • Perl Artistic License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Relations::Family team
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~gaffer/Relations-Family-0.94/Family.pm

°ü°è :: °¡Á· ű×


°ü°è :: °¡Á· ¼³¸í

°ü°è :: Æйи®´Â DBI / DBD :: MySQL °ü°è Äõ¸® ¿£Áø ¸ðµâÀÔ´Ï´Ù. °ü°è :: Æйи®´Â DBI / DBD :: MySQL °ü°è Äõ¸® ¿£Áø Module.Synopsis # dbi, relations :: Family Script¸¦ »ý¼ºÇÕ´Ï´Ù. #! / usr / bin / perl »ç¿ë dbi; °ü°è :: °¡Á·; $ dsn = "dbi : mysql : finder"; $ username = "root"; $ password = ''; $ dbh = dbi-> connect ($ dsn, $ username, $ password, {printerror => 1, raiseError => 0}); $ abstract = »õ·Î¿î °ü°è :: ÃÊ·Ï ($ dbh); $ Family = »õ·Î¿î °ü°è :: °¡Á· ($ Abstract); $ Family-> add_member (-name => '°èÁ¤', -label => 'cust. °èÁ¤', -Database => 'ã±â', -table => '°èÁ¤', -id_field => 'acc_id', -query => {-select => { 'id'=> 'acc_id', 'label'=> "concat (cust_name, '-', balance)"}, -from => , -where => "customer.cust_id = Account.cust_id", -Order_by => "cust_name"}); $ Family-> add_member (-name => 'customer', -label => 'customer', -database => 'finder', -table => 'customer', -id_field => 'cust_id', -query => {-select => { 'id'=> 'cust_id', 'label'=> 'cust_name'}, -from => 'customer', -Order_by => "cust_name"}); $ Family-> add_member (-name => '±¸¸Å', -label => '±¸ÀÔ', -Database => 'Finder', -table => '±¸¸Å', -id_field => 'pur_id', -query => {-select => { 'id'=> 'pur_id', 'label'=> "concat (cust_name, '-', date_format (³¯Â¥, '% m % d, % y')"}, -from = > , -where => 'customer.cust_id = public.cust_id', -Order_by => }); $ Family-> add_lineage (-parent_name => 'customer', -parent_field => 'cust_id', -child_name => '±¸¸Å', -child_field => 'cust_id'); $ Family-> add_rivalry (-brother_name => 'customer', -brother_field => 'cust_id', -sister_name => '°èÁ¤', -sister_field => 'cust_id'); $ Family-> set_Cosen (-label => '°í°´', -IDS => '2,4'); $ Available = $ Family-> get_available (-label => '±¸¸Å'); "¹ß°ß µÈ $ UABALY -> {COUNT} ±¸¸Å : N"À» ÀμâÇϽʽÿÀ. $ id (@ {$ will-> {ids_array}}) {print "ID : $ id label : $ »ç¿ë °¡´ÉÇÑ -> {labels_hash} -> {$ ID} n"; } $ Family-> add_value (-name => 'cust. °èÁ¤', -sql => "concat (cust_name, '-', Àܾ×)", -member_names => '°í°´, °èÁ¤'); $ family-> add_value (-name => 'À¯·á', -sql => "(±ÕÇü> 0, '¾Æ´Ï¿À', '¿¹')", -member_names => '°èÁ¤'); $ Family-> add_value (-name => 'customer', -sql => 'cust_name', -member_names => '°í°´'); $ Family-> add_value (-name => '±¸¸Å', -sql => "concat (cust_name, '-', date_format (³¯Â¥, '% m % d, % y')", -member_names => '±¸¸Å ,°í°´'); $ reunion = $ family-> get_reunion (-data => À¯·á, ±¸¸Å ', -use_labels =>'°í°´ ', -Order_by =>'°í°´, ±¸¸Å '); $ matrix = $ abstract-> select_matrix (-query => $ reunion); Àμâ "¹ß°ß". ½ºÄ®¶ó @ $ matrix. "°ª : n"; foreach $ row (@ $ matrix) {Àμâ "°í°´ : $ row -> { '°í°´'} n"; Àμâ "±¸¸Å : $ row -> { '±¸¸Å'} n"; Àμâ "À¯·á : $ row -> { 'À¯·á'} nn"; } $ dbh-> Disconnect (); ¿ä±¸ »çÇ× : ¡¤ Perl.


°ü°è :: °¡Á· °ü·Ã ¼ÒÇÁÆ®¿þ¾î