{"id":5419,"date":"2014-02-11T11:46:40","date_gmt":"2014-02-11T02:46:40","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=5419"},"modified":"2014-02-12T01:20:40","modified_gmt":"2014-02-11T16:20:40","slug":"activeperl-%e3%81%ab-dbdmysql-%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.moonmile.net\/blog\/archives\/5419","title":{"rendered":"ActivePerl \u306b DBD::mysql \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Unix \u7248\u306f\u7c21\u5358\u306a\u3093\u3060\u3051\u3069\u3001\u3069\u3046\u3082 Windows \u306e\u307b\u3046\u306f cpan \u3067\u306f\u3046\u307e\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\uff08make test \u3042\u305f\u308a\u3067\u3053\u3051\u308b\uff09\u306e\u3067\u3001ppm \u3092\u4f7f\u3048\u3063\u3066\u3053\u3068\u3067\u3002<\/p>\n<p>\u79c1\u306e\u74b0\u5883\u3067\u306f 64bit \u7248\u306e <a href=\"http:\/\/www.activestate.com\/activeperl\">ActivePerl is Perl for Windows, Mac, Linux, AIX, HP-UX &amp; Solaris | ActiveState<\/a> \u304c c:Perl64 \u306b\u5165\u3063\u3066\u307e\u3059\u3002<\/p>\n<p>1. \u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089 ppm \u3092\u8d77\u52d5<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image_thumb10.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"640\" height=\"228\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" \/><\/a><\/p>\n<p>2. Perl Package Manager \u304c\u8d77\u52d5\u3059\u308b\u306e\u3067\u3001\u4e0a\u306e\u691c\u7d22\u306b\u300cdbd-mysql\u300d\u3068\u5165\u529b\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image11.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image_thumb11.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"474\" height=\"480\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" \/><\/a><\/p>\n<p>3\uff0e\u691c\u7d22\u304c\u7d5e\u3089\u308c\u308b\u306e\u3067\u3001\u5de6\u4e0a\u306e mark for install \u3067\u30c1\u30a7\u30c3\u30af\u3057\u305f\u5f8c\u300c\u2192\u300d\u30dc\u30bf\u30f3\u306e run mark action \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image12.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image_thumb12.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"535\" height=\"480\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" \/><\/a><\/p>\n<p>\u6b63\u5e38\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u305f\u3089\u3001c:Perl64sitelibDBD \u306e\u4e2d\u306b mysql.pm \u304c\u3042\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3002<\/p>\n<p><a href=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image13.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/image_thumb13.png\" border=\"0\" alt=\"image\" title=\"image\" width=\"640\" height=\"296\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" \/><\/a><\/p>\n<p>\u25a0\u5b9f\u884c\u30c6\u30b9\u30c8<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nse DBI ;\r\n$db = DBI-&gt;connect(&#039;DBI:mysql:database&#039;,&#039;user&#039;,&#039;pass&#039;);\r\n$rows = $db-&gt;selectall_arrayref(&amp;quot;SELECT id, name, tel, modified from store;&amp;quot;);\r\n@row = @$rows ;        # \u4e00\u5ea6\u3001\u914d\u5217\u306b\u76f4\u3059\r\n$cnt = @row ;        # \u884c\u6570\u3092\u53d6\u5f97\r\nprint &amp;quot;count: $cntn&amp;quot; ;\r\n# \u7e70\u308a\u8fd4\u3057\u51e6\u7406\r\nforeach $r ( @row ) {\r\n    print &amp;quot;num: $r-&gt;&#x5B;0] $r-&gt;&#x5B;1]n&amp;quot; ;\r\n}\r\n\r\n# \u76f4\u63a5\u53c2\u7167\u3059\u308b\u3068\u304d\r\n# print $rows-&gt;&#x5B;0]&#x5B;3] ;\r\n<\/pre>\n<p>fetch \u3067\u56de\u3057\u3066\u3082\u3088\u3044\u306e\u3060\u304c\u3001selectall_arrayref \u3067\u4e00\u6c17\u306b\u914d\u5217\u306b\u53d6\u308a\u8fbc\u3093\u3060\u307b\u3046\u304c\u697d\u304b\u3082\u3057\u308c\u306a\u3044\u3002<br \/>\n\u65e5\u672c\u8a9e\u306f\u300c????\u300d\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u3053\u308c\u3092\u3069\u3046\u3059\u308b\u304b\u306f\u4e0d\u660e\u3002datetime \u578b\u3082\u3069\u3046\u3084\u3063\u3066\u53d6\u308b\u304b\u308f\u304b\u3089\u305a\u3002<\/p>\n<p>\u8ffd\u8a18<br \/>\nUTF8\u306b\u3059\u308b\u306b\u306f\u3001<br \/>\n$db = DBI->connect(&#8216;DBI:mysql:db&#8217;,&#8217;user&#8217;,&#8217;pass&#8217;,{&#8216;mysql_enable_utf8&#8217;=>1});<br \/>\n\u3067\u826f\u3044\u6a21\u69d8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Unix \u7248\u306f\u7c21\u5358\u306a\u3093\u3060\u3051\u3069\u3001\u3069\u3046\u3082 Windows \u306e\u307b\u3046\u306f cpan \u3067\u306f\u3046\u307e\u304f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\uff08make test \u3042\u305f\u308a\u3067\u3053\u3051\u308b\uff09\u306e\u3067\u3001ppm \u3092\u4f7f\u3048\u3063\u3066\u3053\u3068\u3067\u3002 \u79c1\u306e\u74b0\u5883\u3067\u306f 64bit \u7248\u306e Acti &hellip; <a href=\"https:\/\/www.moonmile.net\/blog\/archives\/5419\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,63],"tags":[],"class_list":["post-5419","post","type-post","status-publish","format-standard","hentry","category-dev","category-perl"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=5419"}],"version-history":[{"count":6,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5419\/revisions"}],"predecessor-version":[{"id":5426,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5419\/revisions\/5426"}],"wp:attachment":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=5419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=5419"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=5419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}