0

我正在尝试通过codeigniter框架中的stored_procedure函数将PDF文件直接保存到db oracle(不是路径)

我在 oci8_driver.php 文件中修改了 _execute() 函数并添加了这个

protected function _execute($sql)
{
    $this->stmt_id = FALSE;
    $this->_set_stmt_id($sql);
    $blob=FALSE;
    $myarray=array();
    $myarray = $this->binds;

  if (is_array($myarray)) {
  foreach ($myarray as $value)     {     
  if ($value['type'] ===  113 )
   {

$this->lob = oci_new_descriptor($this->conn_id, OCI_D_LOB);

     $blob=TRUE;
  }  }
 ...........
 ..................
 .....

    $exec_worked = ociexecute($this->stmt_id, $this->_commit);

            if (is_array($myarray)) {    
        foreach ($myarray as $value)     {
           if ($value['type'] ===  113 )
        {
      oci_execute($this->stmt_id, OCI_DEFAULT);

          if($blob)
             {
      $this->lob->savefile($value['value'] );
         oci_commit($this->conn_id);
             }

    }  

 }

并修改同一文件中的 _bind_param() 函数添加此行

     if ($param['type'] === 113)
          oci_bind_by_name($this->stmt_id , $param['name'], $this->lob,    $param['length'], OCI_B_BLOB);

但问题是它保存了两次文件...我测试了程序本身,模型函数都显示它执行了一次,我不知道重复发生在哪里

我的修改会导致问题吗?我应该怎么做?

4

1 回答 1

0

调用$this->db->simple_query()而不是$this->db->query()和/或$this->db->stored_procedure()

于 2012-12-29T02:29:40.713 回答