/**
	* Usage:  store file pointed to by $var in a blob
	*/
	function UpdateBlobFile($table,$column,$val,$where,$blobtype='BLOB')
	{
		switch(strtoupper($blobtype)) {
		default: ADOConnection::outp( "<b>UpdateBlob</b>: Unknown blobtype=$blobtype"); return false;
		case 'BLOB': $type = OCI_B_BLOB; break;
		case 'CLOB': $type = OCI_B_CLOB; break;
		}

		if ($this->databaseType == 'oci8po')
			$sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO ?";
		else
			$sql = "UPDATE $table set $column=EMPTY_{$blobtype}() WHERE $where RETURNING $column INTO :blob";

		$desc = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
		$arr['blob'] = array($desc,-1,$type);

		$this->BeginTrans();
		$rs = ADODB_oci8::Execute($sql,$arr);
		if ($rez = !empty($rs)) $desc->savefile($val);
		$desc->free();
		$this->CommitTrans();

		if ($rez) $rs->Close();
		return $rez;
	}
Example #2
0
 /**
  * Usage:  store file pointed to by $var in a blob
  */
 function UpdateBlobFile($table, $column, $val, $where, $blobtype = 'BLOB')
 {
     switch (strtoupper($blobtype)) {
         default:
             print "<b>UpdateBlob</b>: Unknown blobtype={$blobtype}<br>";
             return false;
         case 'BLOB':
             $type = OCI_B_BLOB;
             break;
         case 'CLOB':
             $type = OCI_B_CLOB;
             break;
     }
     if ($this->databaseType == 'oci8po') {
         $sql = "UPDATE {$table} set {$column}=EMPTY_{$blobtype}() WHERE {$where} RETURNING {$column} INTO ?";
     } else {
         $sql = "UPDATE {$table} set {$column}=EMPTY_{$blobtype}() WHERE {$where} RETURNING {$column} INTO :blob";
     }
     $desc = OCINewDescriptor($this->_connectionID, OCI_D_LOB);
     $arr['blob'] = array($desc, -1, $type);
     $this->BeginTrans();
     $rs = ADODB_oci8::Execute($sql, $arr);
     $rez = !empty($rs);
     $desc->savefile($val);
     $desc->free();
     $this->CommitTrans();
     if ($rez) {
         $rs->Close();
     }
     return $rez;
 }