当前位置: 首页>>代码示例>>PHP>>正文


PHP oci_new_descriptor函数代码示例

本文整理汇总了PHP中oci_new_descriptor函数的典型用法代码示例。如果您正苦于以下问题:PHP oci_new_descriptor函数的具体用法?PHP oci_new_descriptor怎么用?PHP oci_new_descriptor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了oci_new_descriptor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createThumbnail

            $thumb = createThumbnail($image_dir, $image_dir . '_thumb.jpg', 50, 50);
            if (!$thumb) {
                echo "Sorry, an error has occurred while creating thumbnail";
                $uploadOk = 0;
            }
            //Attempt to put image into database
            //Code stolen and adapted from https://stackoverflow.com/questions/11970258/upload-images-as-blobs-in-oracle-using-php
            $conn = connect();
            //RECOREDED DATA VS. RECOREDED DATA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            $sql = 'INSERT INTO images(image_id, sensor_id, date_created, description, thumbnail, recorded_data)
			VALUES (\'' . $_POST['image_id'] . '\', \'' . $_POST['sensor_id'] . '\', to_date(\'' . $_POST['date_created'] . '\',
			\'dd/mm/yyyy HH24:Mi:SS\'), \'' . $_POST['description'] . '\', empty_blob(), empty_blob()) 
			RETURNING thumbnail, recorded_data INTO :thumbnail, :recorded_data';
            $stid = oci_parse($conn, $sql);
            $tblob = oci_new_descriptor($conn, OCI_D_LOB);
            $iblob = oci_new_descriptor($conn, OCI_D_LOB);
            oci_bind_by_name($stid, ':thumbnail', $tblob, -1, OCI_B_BLOB);
            oci_bind_by_name($stid, ':recorded_data', $iblob, -1, OCI_B_BLOB);
            oci_execute($stid, OCI_DEFAULT) or die("Unable to execute query");
            if (!$tblob->save($thumb) || !$iblob->save($image)) {
                oci_rollback($conn);
                echo "Aborted.";
            } else {
                $res = oci_commit($conn);
                if (!$res) {
                    $err = oci_error($conn);
                    trigger_error(htmlentities($err['message']), E_USER_ERROR);
                } else {
                    echo "Image File Successfully Uploaded.";
                    //Show view of the image.
                    //Stolen from Gordon♦'s comment at https://stackoverflow.com/questions/3385982/the-image-cannot-be-displayed-because-it-contains-errors
开发者ID:rkj777,项目名称:OceanObserverSystem,代码行数:31,代码来源:uploadimage.php

示例2: uploadImage

/**
 * Insert image data to database (recoreded_data and thumbnail).
 * First generate an unique image id, then insert image to recoreded_data and resized image to thubnail along with 
 *   other given data
 */
function uploadImage($conn, $sensor_id, $date_created, $description)
{
    $image_id = generateId($conn, "images");
    if ($image_id == 0) {
        return;
    }
    $image2 = file_get_contents($_FILES['file_image']['tmp_name']);
    $image2tmp = resizeImage($_FILES['file_image']);
    $image2Thumbnail = file_get_contents($image2tmp['tmp_name']);
    // encode the stream
    $image = base64_encode($image2);
    $imageThumbnail = base64_encode($image2Thumbnail);
    $sql = "INSERT INTO images (image_id, sensor_id, date_created, description, thumbnail, recoreded_data)\n                      VALUES(" . $image_id . ", " . $sensor_id . ", TO_DATE('" . $date_created . "', 'DD/MM/YYYY hh24:mi:ss'), '" . $description . "', empty_blob(), empty_blob())\n                       RETURNING thumbnail, recoreded_data INTO :thumbnail, :recoreded_data";
    $result = oci_parse($conn, $sql);
    $recoreded_dataBlob = oci_new_descriptor($conn, OCI_D_LOB);
    $thumbnailBlob = oci_new_descriptor($conn, OCI_D_LOB);
    oci_bind_by_name($result, ":recoreded_data", $recoreded_dataBlob, -1, OCI_B_BLOB);
    oci_bind_by_name($result, ":thumbnail", $thumbnailBlob, -1, OCI_B_BLOB);
    $res = oci_execute($result, OCI_DEFAULT) or die("Unable to execute query");
    if ($recoreded_dataBlob->save($image) && $thumbnailBlob->save($imageThumbnail)) {
        oci_commit($conn);
    } else {
        oci_rollback($conn);
    }
    oci_free_statement($result);
    $recoreded_dataBlob->free();
    $thumbnailBlob->free();
    echo "New image is added with image_id ->" . $image_id . "<br>";
}
开发者ID:ayunita,项目名称:OOSproject,代码行数:34,代码来源:datacuratorFunction.php

示例3: insertImage

function insertImage($conn, $photo_id, $owner_name, $descriptive_info, $thumbnail, $photo)
{
    $photo_blob = oci_new_descriptor($conn, OCI_D_LOB);
    $thumbnail_blob = oci_new_descriptor($conn, OCI_D_LOB);
    $subject = $descriptive_info[0];
    $place = $descriptive_info[1];
    $date_time = $descriptive_info[2];
    $description = $descriptive_info[3];
    $permitted = $descriptive_info[4];
    $sql = 'INSERT INTO images (photo_id, owner_name, permitted, subject, place,
		timing, description, thumbnail, photo) VALUES (:photoid, :ownername,
		:permitted, :subject, :place, TO_DATE(:datetime, \'MM/DD/YYYY\'), :description, empty_blob(),
		empty_blob()) returning thumbnail, photo into :thumbnail, :photo';
    $stid = oci_parse($conn, $sql);
    oci_bind_by_name($stid, ':photoid', $photo_id);
    oci_bind_by_name($stid, ':ownername', $owner_name);
    oci_bind_by_name($stid, ':permitted', $permitted);
    oci_bind_by_name($stid, ':subject', $subject);
    oci_bind_by_name($stid, ':place', $place);
    oci_bind_by_name($stid, ':datetime', $date_time);
    oci_bind_by_name($stid, ':description', $description);
    oci_bind_by_name($stid, ':thumbnail', $thumbnail_blob, -1, OCI_B_BLOB);
    oci_bind_by_name($stid, ':photo', $photo_blob, -1, OCI_B_BLOB);
    $res = oci_execute($stid, OCI_DEFAULT);
    if ($thumbnail_blob->save($thumbnail) && $photo_blob->save($photo)) {
        oci_commit($conn);
    } else {
        oci_rollback($conn);
    }
    oci_free_statement($stid);
    $photo_blob->free();
    $thumbnail_blob->free();
}
开发者ID:ismailmare,项目名称:Photoshare,代码行数:33,代码来源:uploadDB.php

示例4: prep_row_id

 public function prep_row_id()
 {
     if ($new_id = @oci_new_descriptor($this->db_handle, OCI_D_ROWID)) {
         return $new_id;
     } else {
         $this->handle_error('new_descriptor', oci_error($this->db_handle));
         return false;
     }
 }
开发者ID:bryandease,项目名称:VuFind-Plus,代码行数:9,代码来源:USQOracle.php

示例5: execute

 public function execute($sql, array $data = null)
 {
     $this->connect();
     if (!is_array($data)) {
         $data = array();
     }
     $data = array_values($data);
     $lob = null;
     $ldt = null;
     foreach ($data as $i => $v) {
         switch (gettype($v)) {
             case 'boolean':
             case 'integer':
                 $data[$i] = (int) $v;
                 oci_bind_by_name($sql, 'f' . $i, $data[$i], -1, SQLT_INT);
                 break;
             default:
                 // keep in mind oracle needs a transaction when inserting LOBs, aside from the specific syntax:
                 // INSERT INTO table (column, lobcolumn) VALUES (?, ?, EMPTY_BLOB()) RETURNING lobcolumn INTO ?
                 if (is_resource($v) && get_resource_type($v) === 'stream') {
                     $ldt = $v;
                     $lob = oci_new_descriptor($this->lnk, OCI_D_LOB);
                     oci_bind_by_name($sql, 'f' . $i, $lob, -1, OCI_B_BLOB);
                     continue;
                 }
                 if (!is_string($data[$i]) && !is_null($data[$i])) {
                     $data[$i] = serialize($data[$i]);
                 }
                 oci_bind_by_name($sql, 'f' . $i, $data[$i]);
                 break;
         }
     }
     $temp = oci_execute($sql, $this->transaction ? OCI_NO_AUTO_COMMIT : OCI_COMMIT_ON_SUCCESS);
     if (!$temp) {
         throw new DatabaseException('Could not execute query : ' . oci_error($sql));
     }
     if ($lob) {
         while (!feof($ldt) && ($ltmp = fread($ldt, 8192)) !== false) {
             $lob->write($ltmp);
             $lob->flush();
         }
         $lob->free();
     }
     $this->aff = oci_num_rows($sql);
     return $sql;
 }
开发者ID:vakata,项目名称:database,代码行数:46,代码来源:Oracle.php

示例6: bindValue

 /**
  * Binds a value
  *
  * @param mixed $param param (column)
  * @param mixed $value value for param
  * @param mixed $type  optional data type
  *
  * @return bool bound
  */
 public function bindValue($param, $value, $type = null)
 {
     $ok = false;
     try {
         $param = $this->_getBindVar($param);
         if (PDO::PARAM_LOB == $type) {
             $lob = \oci_new_descriptor($this->_con, \OCI_D_LOB);
             $ok = \oci_bind_by_name($this->_stmt, $param, $lob, -1, \OCI_B_BLOB);
             $this->_bindsLob[$param] = array('lob' => $lob, 'value' => $value);
         } else {
             $ok = \oci_bind_by_name($this->_stmt, $param, $value);
             $this->_binds[$param] = $value;
         }
     } catch (\Exception $e) {
         throw new \PDOException($e->getMessage());
     }
     return $ok;
 }
开发者ID:taq,项目名称:pdooci,代码行数:27,代码来源:Statement.php

示例7: ajouterContenu

 public function ajouterContenu($id_fichier, $contenu)
 {
     $sql = "INSERT INTO CONTENU(ID_FICHIER,CONTENU) VALUES ({$id_fichier}, EMPTY_CLOB())\n        RETURNING CONTENU INTO :CONTENU_loc";
     $conn = oci_connect("DBA_PARAPHEUR", "12345678", "XE");
     $stmt = oci_parse($conn, $sql);
     // Creates an "empty" OCI-Lob object to bind to the locator
     $clob = oci_new_descriptor($conn, OCI_D_LOB);
     // Bind the returned Oracle LOB locator to the PHP LOB object
     oci_bind_by_name($stmt, ":CONTENU_loc", $clob, -1, OCI_B_CLOB);
     // Execute the statement using , OCI_DEFAULT - as a transaction
     oci_execute($stmt, OCI_DEFAULT) or die("Unable to execute query\n");
     // Now save a value to the clob
     if (!$clob->save($contenu)) {
         // On error, rollback the transaction
         oci_rollback($conn);
     } else {
         // On success, commit the transaction
         oci_commit($conn);
     }
 }
开发者ID:svast,项目名称:start,代码行数:20,代码来源:Contenu.php

示例8: bindParam

 public function bindParam($parameter, &$variable, $data_type = -1, $length = 0, $driver_options = null)
 {
     if ($parameter[0] != ':' && !is_numeric($parameter)) {
         $parameter = ':' . $parameter;
     }
     if (!$length) {
         $length = -1;
     }
     $params_info =& $this->_params_info;
     switch ($data_type) {
         case PDO::PARAM_INT:
             $type = SQLT_INT;
             break;
         case PDO::PARAM_LOB:
             if (isset($params_info[$parameter])) {
                 $p = $params_info[$parameter];
                 $lob = oci_new_descriptor($this->_link, OCI_DTYPE_LOB);
                 if (oci_bind_by_name($this->_result, $p, $lob, -1, SQLT_BLOB)) {
                     $this->_bound_params[$p] = 1;
                     $this->lobs[$p] = array(&$lob, &$variable);
                     return true;
                 }
                 oci_free_descriptor($lob);
             }
             return false;
             break;
         default:
             $type = SQLT_CHR;
             break;
     }
     if (isset($params_info[$parameter]) && oci_bind_by_name($this->_result, $params_info[$parameter], $variable, $length, $type)) {
         $this->_bound_params[$params_info[$parameter]] = 1;
         return true;
     }
     return false;
 }
开发者ID:Deepab23,项目名称:clinic,代码行数:36,代码来源:oci_statement.php

示例9: set_productline

 /**
  * 新建生产线
  */
 public function set_productline($showxml)
 {
     $this->load->helper('url');
     $this->load->helper('oracledb');
     $id = getCurSequeens("SEQ_PPC_PRODUCTLINE");
     $codes = $this->input->post('selectcodes');
     $staid = $this->input->post('staid');
     $devcode = $this->input->post('devcode');
     $isload = $this->input->post('isload');
     $linetype = $this->input->post('linetype');
     $caption = "pl_" . $id . "_" . $staid;
     $alias = $this->input->post('alias');
     $data = array('ID' => $id, 'Code' => $codes, 'SatCode' => $staid, 'Caption' => $caption, 'Alias' => $alias, 'DevCode' => $devcode, 'LINETYPE' => $linetype, 'ISLOAD' => $isload, 'Version' => 'a0', 'RawVer' => '-1', 'Status' => "run", 'Author' => "", 'ISVIEW' => 1);
     //以下是直接使用oci做clob的插入
     $sid = $this->config->item('dbusrsid');
     $password = $this->config->item('dbusrpassword');
     $dburl = $this->config->item('dbusrurl');
     $conn = oci_connect($sid, $password, $dburl, "AL32UTF8");
     $sql = "INSERT INTO\n                    \"T_PPC_ProductLine\"\n                      (\n                        ID,   \"Code\",\"SatCode\",\"Caption\",\"Alias\",\"RawVer\",\"Status\",\"DevCode\",LINETYPE,\"Author\",\"Version\",ISVIEW,ISLOAD,\n                        PLXML,\"ShowXml\"\n                      )\n                   VALUES\n                      ( " . $id . ",'" . $codes . "','" . $staid . "','" . $caption . "','" . $alias . "',-1,'run','" . $devcode . "','" . $linetype . "','','a0',1," . $isload . ",EMPTY_CLOB(), EMPTY_CLOB()\n                      )\n                   RETURNING\n                      PLXML,\"ShowXml\" INTO :pllob,:showlob";
     // echo $sql;
     $stmt = oci_parse($conn, $sql);
     $PlLOB = oci_new_descriptor($conn, OCI_D_LOB);
     $showLOB = oci_new_descriptor($conn, OCI_D_LOB);
     oci_bind_by_name($stmt, ":pllob", $PlLOB, -1, OCI_B_CLOB);
     oci_bind_by_name($stmt, ":showlob", $showLOB, -1, OCI_B_CLOB);
     oci_execute($stmt, OCI_DEFAULT) or die("Unable to execute query\n");
     if (!$PlLOB->save('') || !$showLOB->save('')) {
         oci_rollback($conn);
     } else {
         oci_commit($conn);
     }
     // Free resources
     oci_free_statement($stmt);
     $PlLOB->free();
     $showLOB->free();
     // $showxml = $this->input->post('formxml');
     updateShowCLOB($id, $showxml);
     $cdate = updateTime($id, 'T_PPC_ProductLine', 'CreateTime');
     $data['CreateTime'] = $cdate;
     return $data;
 }
开发者ID:liujidong,项目名称:pre_data,代码行数:44,代码来源:productline_model.php

示例10: DBSaveLob

function DBSaveLob($connection, $sql, $blobParamName, $data, $lobType)
{
    // Guarda datos en un clob..
    global $dbError;
    $lob = oci_new_descriptor($connection, OCI_D_LOB);
    $stmt = oci_parse($connection, $sql);
    oci_bind_by_name($stmt, ":" . $blobParamName, $lob, -1, $lobType);
    $error = !oci_execute($stmt, OCI_DEFAULT);
    $result = $lob->write($data);
    if ($result) {
        oci_commit($connection);
    }
    if ($error) {
        $dbError = oci_error($stmt);
        if (isset($dbError["offset"])) {
            throw new Exception($dbError["message"]);
        }
    }
    return $result;
}
开发者ID:javierlov,项目名称:FuentesWeb,代码行数:20,代码来源:oracle_funcs.php

示例11: insertOneRow

 function insertOneRow($table, $row, $fname)
 {
     // "INSERT INTO tables (a, b, c)"
     $sql = "INSERT INTO " . $this->tableName($table) . " (" . join(',', array_keys($row)) . ')';
     $sql .= " VALUES (";
     // for each value, append ":key"
     $first = true;
     $returning = '';
     foreach ($row as $col => $val) {
         if (is_object($val)) {
             $what = "EMPTY_BLOB()";
             assert($returning === '');
             $returning = " RETURNING {$col} INTO :bval";
             $blobcol = $col;
         } else {
             $what = ":{$col}";
         }
         if ($first) {
             $sql .= "{$what}";
         } else {
             $sql .= ", {$what}";
         }
         $first = false;
     }
     $sql .= ") {$returning}";
     $stmt = oci_parse($this->mConn, $sql);
     foreach ($row as $col => $val) {
         if (!is_object($val)) {
             if (oci_bind_by_name($stmt, ":{$col}", $row[$col]) === false) {
                 $this->reportQueryError($this->lastErrno(), $this->lastError(), $sql, __METHOD__);
             }
         }
     }
     if (($bval = oci_new_descriptor($this->mConn, OCI_D_LOB)) === false) {
         $e = oci_error($stmt);
         throw new DBUnexpectedError($this, "Cannot create LOB descriptor: " . $e['message']);
     }
     if (strlen($returning)) {
         oci_bind_by_name($stmt, ":bval", $bval, -1, SQLT_BLOB);
     }
     if (oci_execute($stmt, OCI_DEFAULT) === false) {
         $e = oci_error($stmt);
         $this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
     }
     if (strlen($returning)) {
         $bval->save($row[$blobcol]->getData());
         $bval->free();
     }
     if (!$this->mTrxLevel) {
         oci_commit($this->mConn);
     }
     oci_free_statement($stmt);
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:53,代码来源:DatabaseOracle.php

示例12: setClob

 /**
  * @param string $paramIndex
  * @param mixed $clob Clob object or string containing data.
  * @return void
  */
 function setClob($paramIndex, $clob)
 {
     require_once CREOLE_ROOT . 'util/Clob.php';
     if (!$clob instanceof Clob) {
         $c = new Clob();
         $c->setContents($clob);
         $clob = $c;
     }
     $this->lobDescriptors[$paramIndex] = oci_new_descriptor($this->conn->getResource(), OCI_D_LOB);
     $this->lobs[$paramIndex] = $clob;
 }
开发者ID:saiber,项目名称:www,代码行数:16,代码来源:OCI8PreparedStatement.php

示例13: UpdateQuery

 /**
  * Build and execute a database update query from an array of keys/values.
  *
  * @param string The table to insert into.
  * @param array Associative array containing key/value pairs to update.
  * @param string The where clause to apply to the update
  * @param bool TRUE to interpret NULL as being database NULL, FALSE to mean an empty string
  *
  * @return boolean True on success, false on error.
  */
 function UpdateQuery($table, $values, $where = "", $useNullValues = false)
 {
     $fields = array();
     $lobVals = array();
     $lobDesc = array();
     foreach ($values as $k => $v) {
         if (strlen($v) > 4000) {
             $lobVals[':' . $k] = $v;
             $lobDesc[':' . $k] = oci_new_descriptor($this->connection, OCI_D_LOB);
             $v = ':' . $k;
         } else {
             if ($useNullValues) {
                 if (is_null($v)) {
                     $v = " ";
                 } else {
                     $v = "'" . $this->Quote($v) . "'";
                 }
             } else {
                 $v = "'" . $this->Quote($v) . "'";
             }
         }
         $fields[] = sprintf("%s=%s", $k, $v);
     }
     $fields = implode(",", $fields);
     if ($where != "") {
         $fields .= sprintf(" WHERE %s", $where);
     }
     $query = sprintf('UPDATE [|PREFIX|]%s SET %s', $table, $fields);
     if ($this->TablePrefix !== null) {
         $query = str_replace("[|PREFIX|]", $this->TablePrefix, $query);
     } else {
         $query = str_replace("[|PREFIX|]", '', $query);
     }
     $resource = oci_parse($this->connection, $query);
     if (!$resource) {
         $e = oci_error($this->connection);
         $this->SetError($e['message']);
         return false;
     }
     foreach ($lobDesc as $k => $v) {
         oci_bind_by_name($resource, $k, $lobDesc[$k], -1, OCI_B_CLOB);
         $lobDesc[$k]->WriteTemporary($lobVals[$k]);
     }
     $result = oci_execute($resource);
     foreach ($lobDesc as $k => $v) {
         $lobDesc[$k]->close();
         $lobDesc[$k]->free();
     }
     if (!$result) {
         $e = oci_error($resource);
         $this->SetError($e['message']);
         return false;
     }
     return oci_commit($this->connection);
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:65,代码来源:oci8.php

示例14: generateId

    // description
    $description = $_POST['desc_audio'];
    // Audio Type Check
    $audioType = $_FILES['file_audio']['type'];
    if ($audioType != "audio/wav") {
        echo "File Not Found/Extension not allowed, please choose a wav file";
    } else {
        $audio_id = generateId($conn, "audio_recordings");
        if ($audio_id == 0) {
            return;
        }
        $audio2 = file_get_contents($_FILES['file_audio']['tmp_name']);
        $audio = base64_encode($audio2);
        $sql = "INSERT INTO audio_recordings(recording_id, sensor_id, date_created, length, description, recorded_data)\n                         VALUES(" . $audio_id . "," . $sensor_id . ", TO_DATE('" . $date_created . "', 'DD/MM/YYYY hh24:mi:ss')," . $length . ",'" . $description . "',empty_blob())\n                         RETURNING recorded_data INTO :recorded_data";
        $result = oci_parse($conn, $sql);
        $recorded_dataBlob = oci_new_descriptor($conn, OCI_D_LOB);
        oci_bind_by_name($result, ":recorded_data", $recorded_dataBlob, -1, OCI_B_BLOB);
        $res = oci_execute($result, OCI_DEFAULT) or die("Unable to execute query");
        if ($recorded_dataBlob->save($audio)) {
            oci_commit($conn);
        } else {
            oci_rollback($conn);
        }
        oci_free_statement($result);
        $recorded_dataBlob->free();
        echo "New audio is added with image_id ->" . $audio_id . "<br>";
    }
}
// ----Upload Image----
// TO DO: thumbnail -> resize the image and update the database
if (isset($_POST["submit_image"])) {
开发者ID:ayunita,项目名称:OOSproject,代码行数:31,代码来源:datacurator.php

示例15: __construct

 public function __construct($conn, $binary)
 {
     $this->conn = $conn;
     $this->binary = $binary;
     $this->lob = oci_new_descriptor($conn, OCI_D_LOB);
 }
开发者ID:reoring,项目名称:sabel,代码行数:6,代码来源:Blob.php


注:本文中的oci_new_descriptor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。