{"id":266298,"date":"2015-09-24T13:14:03","date_gmt":"2015-09-24T09:14:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=266298"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=266298","title":{"rendered":"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Yii 1.1 oci8Pdo \u0438 \u0431\u0438\u043d\u0434 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 CLOB\/BLOB"},"content":{"rendered":"<p>       \u0412 \u043c\u043e\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 Yii 1.1 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 Oracle 9g. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u044b\u0437\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/yjeroen\/oci8Pdo\">oci8Pdo<\/a>.<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0430\u043d\u043e\u0432 \u0432 \u0431\u0430\u0437\u0443 \u0432 \u043f\u043e\u043b\u0435 BLOB. \u0422.\u043a. \u0430\u0432\u0442\u043e\u0440 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u0438\u0448\u0435\u0442:   <\/p>\n<blockquote><p>The goal of this PDO class is to simulate 99% of the PDO functions that you use in an application.<\/p><\/blockquote>\n<p>\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0431\u044b\u043b\u043e \u043c\u0430\u043b\u043e.<\/p>\n<p>  <b>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u043a\u0430\u043d:<\/b><\/p>\n<pre><code class=\"php\">&lt;?php     $doc_scan = file_get_contents($file);     $db = Yii::app()-&gt;dbOracle;     $stmt = $db-&gt;createCommand(&quot;update scan_document set DOCUM_SCAN=:doc_xml, DOC_SCAN=:doc_scan where DOCUM_ID=:docum_id&quot;);     $stmt-&gt;bindParam(':doc_xml', $doc_xml, PDO::PARAM_LOB);     $stmt-&gt;bindParam(':doc_scan', $doc_scan, PDO::PARAM_LOB);     $stmt-&gt;bindValue(':docum_id', $add-&gt;DOCUM_ID);     $stmt-&gt;query(); ?&gt; <\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0435 \u0442\u0443\u0442 \u0442\u043e \u0431\u044b\u043b\u043e: <i>ORA-01465: invalid hex number.<\/i><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0421\u0442\u0430\u043b\u0438 \u0440\u0430\u0441\u043a\u0443\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0438\u0441\u044c \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430 bindParam \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Oci8PDO_Statement \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"php\">&lt;?php public function bindParam(     $parameter,     &$variable,     $data_type = PDO::PARAM_STR,     $length = -1,     $driver_options = null ) { \t\/\/Not checking for $data_type === PDO::PARAM_INT, because this gives problems when inserting\/updating integers into a VARCHAR column.     if ($driver_options !== null) {         throw new PDOException('$driver_options is not implemented for Oci8PDO_Statement::bindParam()');     }          if (is_array($variable)) {         return oci_bind_array_by_name(             $this-&gt;_sth,             $parameter,             $variable,             count($variable),             $length         );     } else {         if ($length == -1) {             $length = strlen((string)$variable);         }          return oci_bind_by_name($this-&gt;_sth, $parameter, $variable, $length);     } } ?&gt; <\/code><\/pre>\n<p>  \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 $data_type \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u0422\u0430\u043a \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e CLOB \u0438\u043b\u0438 BLOB \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. \u0414\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u044b\u043b\u043e \u043d\u0435\u043a\u0443\u0434\u0430, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u043f\u0438\u043b\u0438\u0432\u0430\u0442\u044c oci8Pdo.<\/p>\n<p>  \u0412 \u043a\u043b\u0430\u0441\u0441 Oci8PDO \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 PDO \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u0438 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0414\u0411:<\/p>\n<pre><code class=\"php\">&lt;?php \t\/**      * Ananalog constant OCI_B_CLOB      *      * @const int      *\/     const PARAM_CLOB = 112;     \/**      * Ananalog constant OCI_B_BLOB      *      * @const int      *\/     const PARAM_BLOB = 113;       \/\/ ..............       \/**      * Return the resource connection      *      * @return mixed      *\/     public function getDbh() {         return $this-&gt;_dbh;     } ?&gt;  <\/code><\/pre>\n<p>  \u0418 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u0438\u043b\u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 bindParam \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 Oci8PDO_Statement:<\/p>\n<pre><code class=\"php\">&lt;?php \tpublic function bindParam(         $parameter,         &$variable,         $data_type = PDO::PARAM_STR,         $length = -1,         $driver_options = null     ) {     \t     \t\/\/ ................      \tif ($data_type == Oci8PDO::PARAM_BLOB) {             $clob = oci_new_descriptor($this-&gt;_pdoOci8-&gt;getDbh(), OCI_D_LOB);             $res = oci_bind_by_name($this-&gt;_sth, $parameter, $clob, -1, OCI_B_BLOB);             $clob-&gt;writeTemporary($variable, OCI_TEMP_BLOB);             return $res;         } else if ($data_type == Oci8PDO::PARAM_CLOB) {             $clob = oci_new_descriptor($this-&gt;_pdoOci8-&gt;getDbh(), OCI_D_LOB);             $res = oci_bind_by_name($this-&gt;_sth, $parameter, $clob, -1, OCI_B_CLOB);             $clob-&gt;writeTemporary($variable, OCI_TEMP_CLOB);             return $res;         }         else {             return oci_bind_by_name($this-&gt;_sth, $parameter, $variable, $length);         }      } ?&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 CLOB\/BLOB \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e:<\/p>\n<pre><code class=\"php\">&lt;?php  $doc_scan = file_get_contents($file); $db = Yii::app()-&gt;dbOracle; $stmt = $db-&gt;createCommand(&quot;update scan_document set DOCUM_SCAN=:doc_xml, DOC_SCAN=:doc_scan where DOCUM_ID=:docum_id&quot;);  $stmt-&gt;bindParam(':doc_xml', $doc_xml, Oci8PDO::PARAM_CLOB); \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b $stmt-&gt;bindParam(':doc_scan', $doc_scan, Oci8PDO::PARAM_BLOB); \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043d\u0430\u0448\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b $stmt-&gt;bindValue(':docum_id', $add-&gt;DOCUM_ID); $stmt-&gt;query();  ?&gt; <\/code><\/pre>\n<p>  <b>\u0418\u0442\u043e\u0433:<\/b><\/p>\n<p>  \u0414\u043e\u043f\u0438\u043b \u0431\u044b\u043b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u0438 \u0432 \u043f\u0443\u043b\u0440\u0435\u043a\u0432\u0435\u0441\u0442 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 oci8Pdo <a href=\"https:\/\/github.com\/yjeroen\">yjeroen<\/a>. \u041a\u043e\u0433\u0434\u0430 \u0433\u0443\u0433\u043b\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u0431\u044b\u043b\u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043c\u043e\u0439 \u043e\u043f\u044b\u0442 \u043a\u043e\u043c\u0443 \u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043c\u043e\u0436\u0435\u0442.<\/p>\n<p>  <b>P.S.:<\/b> \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043a\u0440\u0438\u0442\u0438\u043a\u0435 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u043c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0445.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/267609\/\"> http:\/\/habrahabr.ru\/post\/267609\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u043c\u043e\u0435\u0439 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 Yii 1.1 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 Oracle 9g. \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u044b\u0437\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/yjeroen\/oci8Pdo\">oci8Pdo<\/a>.<\/p>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0430\u043d\u043e\u0432 \u0432 \u0431\u0430\u0437\u0443 \u0432 \u043f\u043e\u043b\u0435 BLOB. \u0422.\u043a. \u0430\u0432\u0442\u043e\u0440 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u043f\u0438\u0448\u0435\u0442:   <\/p>\n<blockquote><p>The goal of this PDO class is to simulate 99% of the PDO functions that you use in an application.<\/p><\/blockquote>\n<p>\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d \u0441\u043e\u043c\u043d\u0435\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0431\u044b\u043b\u043e \u043c\u0430\u043b\u043e.<\/p>\n<p>  <b>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0441\u043a\u0430\u043d:<\/b><\/p>\n<pre><code class=\"php\">&lt;?php     $doc_scan = file_get_contents($file);     $db = Yii::app()-&gt;dbOracle;     $stmt = $db-&gt;createCommand(&quot;update scan_document set DOCUM_SCAN=:doc_xml, DOC_SCAN=:doc_scan where DOCUM_ID=:docum_id&quot;);     $stmt-&gt;bindParam(':doc_xml', $doc_xml, PDO::PARAM_LOB);     $stmt-&gt;bindParam(':doc_scan', $doc_scan, PDO::PARAM_LOB);     $stmt-&gt;bindValue(':docum_id', $add-&gt;DOCUM_ID);     $stmt-&gt;query(); ?&gt; <\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0435 \u0442\u0443\u0442 \u0442\u043e \u0431\u044b\u043b\u043e: <i>ORA-01465: invalid hex number.<\/i>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-266298","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=266298"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266298\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=266298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=266298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=266298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}