{"id":851,"date":"2016-08-15T23:24:24","date_gmt":"2016-08-15T14:24:24","guid":{"rendered":"http:\/\/esoro.jp\/?p=851"},"modified":"2016-08-15T23:32:31","modified_gmt":"2016-08-15T14:32:31","slug":"zend_db%e3%81%ae%e5%be%ae%e5%a6%99%e3%81%aa%e7%9b%b8%e9%81%95%e3%81%ab%e3%83%8f%e3%83%9e%e3%82%8b","status":"publish","type":"post","link":"https:\/\/esoro.jp\/?p=851","title":{"rendered":"Zend_Db\u306e\u5fae\u5999\u306a\u76f8\u9055\u306b\u30cf\u30de\u308b"},"content":{"rendered":"<p>\u4eca\u3001ZendFrameWork\u3092\u4f7f\u3063\u305fphp\u30a2\u30d7\u30ea\u3092DB2\u304b\u3089Oracle\u63a5\u7d9a\u3078\u5909\u3048\u308b\u5bfe\u5fdc\u3092\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nphp\u306f\u6570\u5e74\u524d\u306b\u5c11\u3057\u89e6\u3063\u305f\u7a0b\u5ea6\u3067\u3057\u305f\u304c\u3001\u57fa\u672c\u7684\u306b\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30b9\u30da\u30c3\u30af\u306f\u4f55\u3082\u5909\u3048\u306a\u3044\u3068\u3044\u3046\u524d\u63d0\u306a\u306e\u3067\u3001DB\u63a5\u7d9a\u90e8\u5206\u3092\u5909\u3048\u3001DB2\u72ec\u81ea\u306eSQL\u90e8\u5206\u3092\u5909\u3048\u308c\u3070\u305d\u3093\u306a\u306b\u6642\u9593\u306f\u639b\u304b\u3089\u306a\u3044\u3060\u308d\u3046\u3068\u601d\u3063\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u63a5\u7d9a\u90e8\u5206\u306f\u3001<br \/>\n$conn = Zend_Db::factory(&#8220;db2&#8221;,$params);<br \/>\n\u3092<br \/>\n$conn = Zend_Db::factory(&#8220;Oracle&#8221;,$params);<br \/>\n\u306b<\/p>\n<p>SQL\u5b9f\u884c\u90e8\u5206\u306f<br \/>\n$stmt = new Zend_Db_Statement_DB2($conn, $sqlString);<br \/>\n\u3092<br \/>\n$stmt = new Zend_Db_Statement_Oracle($conn, $sqlString);<br \/>\n\u306b\u3001\u305d\u306e\u4ed6DB2\u72ec\u81ea\u306eSQL\u3092Oracle\u5411\u3051\u306bSQL\u3092\u66f8\u304d\u63db\u3048\u3066\u3044\u304f\u5730\u5473\u306a\u4f5c\u696d\u3067\u3059\u3002\u3002<\/p>\n<p>\u958b\u767a\u74b0\u5883\u306f\u3001<br \/>\npleiades 4.6 Neon PHP\u3000\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\nphp\/pear\u306bZend\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3001Oracle\u63a5\u7d9a\u306e\u70ba\u306bInstantClient12\u3092\u5165\u308c\u3001<br \/>\nphp.ini\u306f\u3001<br \/>\nextension=php_oci8_12c.dll\u3084extension=php_pdo_oci.dll\u3092\u6709\u52b9\u306b\u3001<br \/>\niconv.internal_encoding=UTF-8\u3000\u3067\u30de\u30eb\u30c1\u30d0\u30a4\u30c8\u5bfe\u5fdc\u3068\u3057\u3001<br \/>\n\u5927\u4f53\u958b\u767a\u74b0\u5883\u304c\u6574\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u3001DB2\u306e\u30c6\u30fc\u30d6\u30eb\u3092OracleDB\u306b\u4f5c\u6210\u3057\u3001XAMPP\u3092\u52d5\u304b\u3057\u3066\u753b\u9762\u3092\u52d5\u304b\u3057\u3066\u307f\u308b\u3068\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u304c\u3001<br \/>\nInvalid bind-variable position &#8216;?&#8217;<br \/>\n\u30d0\u30a4\u30f3\u30c9\u304c\u30a4\u30f3\u30d0\u30ea\u30c3\u30c9\uff1f\u4f55\u3067\u3060\u308d\u3046\uff1f\uff1f<br \/>\n\u4f55\u3082\u307e\u3060\u5909\u3048\u3066\u306a\u3044\u7b87\u6240\u306a\u3093\u3060\u3051\u3069\u3002\u3002<\/p>\n<p>\u3067\u30cd\u30c3\u30c8\u3067\u60c5\u5831\u53ce\u96c6\u3057\u3066\u3044\u304f\u3068\u4e0b\u8a18\u3092\u767a\u898b<br \/>\n<a href=\"http:\/\/php.net\/manual\/ja\/function.oci-bind-by-name.php\" target=\"_blank\">oci_bind_by_name<\/a><br \/>\nOracle \u306f\u30af\u30a8\u30b9\u30c1\u30e7\u30f3\u30de\u30fc\u30af\u3092\u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u3068\u3057\u3066\u4f7f\u3044\u307e\u305b\u3093\u3002 <\/p>\n<p>\u3068\u306e\u4e8b\u3002\u3002<\/p>\n<p>\u307e\u3063\u305f\u304f\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u7121\u3044\u7b87\u6240\u3082\u305f\u304f\u3055\u3093\u3042\u308a\u3001\u3044\u308d\u3044\u308d\u7d99\u627f\u3057\u3066\u3044\u308b\u65e2\u5b58\u30bd\u30fc\u30b9\u3092\u8003\u616e\u3057\u3001<br \/>\n?\u3092\u8ae6\u3081\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b:0\u306a\u3069\u306b\u7f6e\u304d\u63db\u3048\u3066\u3044\u3053\u3046\u3068\u6c7a\u65ad\u3002<\/p>\n<p>$sqlString = $sqlString . &#8220;? = COLUMN_NAME &#8220;;<br \/>\n\u3068\u3044\u3046\u3088\u3046\u306a\u7b87\u6240\u3092<br \/>\n$cnt = 0;<br \/>\n$sqlString = $sqlString . &#8220;:&#8221; . $cnt++ . &#8221; = COLUMN_NAME &#8220;;<br \/>\n\u306b\u5909\u3048\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u5909\u66f4\u7b87\u6240\u306f\u5f53\u521d\u60f3\u5b9a\u3057\u305f\u500d\u4ee5\u4e0a\u306b\u306a\u308a\u305d\u3046\u3067\u3059\u3002<br \/>\n\u5e78\u3044\u6642\u9593\u304c\u3042\u308b\u306e\u3067\u3001\u9593\u306b\u5408\u3046\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u53c2\u308a\u307e\u3057\u305f\u3002\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u3001ZendFrameWork\u3092\u4f7f\u3063\u305fphp\u30a2\u30d7\u30ea\u3092DB2\u304b\u3089Oracle\u63a5\u7d9a\u3078 &hellip; <a href=\"https:\/\/esoro.jp\/?p=851\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/esoro.jp\/index.php?rest_route=\/wp\/v2\/posts\/851"}],"collection":[{"href":"https:\/\/esoro.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/esoro.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/esoro.jp\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/esoro.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=851"}],"version-history":[{"count":0,"href":"https:\/\/esoro.jp\/index.php?rest_route=\/wp\/v2\/posts\/851\/revisions"}],"wp:attachment":[{"href":"https:\/\/esoro.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/esoro.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/esoro.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}